Quantcast
Viewing all articles
Browse latest Browse all 18858

Pulling in a WPF Window from Another WPF Project

Synopsys: I have a WPF class project that defines a <Window> in the xaml. I need to make few if any changes here, and it must stay a class project.

I want to start the class library above as a stand-alone program. The idea is to simply create a WPF Windows Application, and pull in the <Window> defined in the class library above.

I’m showing the code below. The compile error I’m getting from the Windows Application when I try to pull in the Class Library is as follows:

The tag 'UserInterface' does not exist in XML namespace 'clr-namespace:TYBRIN.GFP.FPN.MSGH.UserInterface;assembly=TYBRIN.GFP.FPN.MSGH.UserInterface'. Line 13 Position 10.

This surprised me since intellisense recognizes that the class StatusUI exists in the namespace TYBRIN.GFP.FPN.MSGH.UserInterface.StatusUI.

Here’s the first few lines of WPF from the class library:

<Window x:Class="TYBRIN.GFP.FPN.MSGH.UserInterface.StatusUI"

   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

   xmlns:msgh="clr-namespace:TYBRIN.GFP.FPN.MSGH;assembly=TYBRIN.GFP.FPN.MSGH"

       xmlns:UserInterface="clr-namespace:TYBRIN.GFP.FPN.MSGH.UserInterface"

       xmlns:commands="clr-namespace:TYBRIN.GFP.FPN.MSGH.UserInterface.Commands"

       xmlns:msghConverters="clr-namespace:TYBRIN.GFP.FPN.MSGH.UserInterface.Converters" x:Name="statusUI"

Here’s the xaml code from the Windows Application, where I think I’m pulling in the WPF <Window> from the class library:

<Window x:Class="MessageHandler.MainWindow"

       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

       xmlns:ui="clr-namespace:TYBRIN.GFP.FPN.MSGH.UserInterface;assembly=TYBRIN.GFP.FPN.MSGH.UserInterface"

       Title="MainWindow" Height="400" Width="800">

   <Grid>

       <Grid.RowDefinitions>

           <RowDefinition Height="400" />

       </Grid.RowDefinitions>

       <Grid.ColumnDefinitions>

           <ColumnDefinition Width="800" />

       </Grid.ColumnDefinitions>

       <ui:StatusUI Height="400" Width="800" HorizontalAlignment="Left" Margin="0,0,0,0"></ui:StatusUI>

   </Grid>

</Window>


Randy


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>