Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue with x:Name with XAML used between WPF and Silverlight
    primarykey
    data
    text
    <p>I'm having a strange namespace resolution issue in my user control XAML files.</p> <p>If I create a new WPF library, it adds the following:</p> <pre><code>&lt;UserControl x:Class="UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"&gt; &lt;Grid&gt; &lt;/Grid&gt; &lt;/UserControl&gt; </code></pre> <p>This evaluates to a class name of MyLibraryNameSpace.UserControl1.</p> <p>However, if I add a Silverlight class library and add a UserControl to that application, I get the following XAML</p> <pre><code>&lt;UserControl x:Class="MyLibraryNameSpace.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"&gt; &lt;Grid x:Name="LayoutRoot" Background="White"&gt; &lt;/Grid&gt; &lt;/UserControl&gt; </code></pre> <p>This evaluates to the same thing, but the XAML is different, so I can't have Silverlight and WPF projects referring to the same XAML since the x:Class statement would be correct for one and incorrect for the other. If I specify x:Class="MyLibraryNameSpace.UserControl1" in WPF it will be interpreted as MyLibraryNameSpace.MyLibraryNameSpace.UserControl1 under my current project.</p> <p>How do I get my WPF library to use fully qualified class names or otherwise resolve this scenario so I can use a single namespace for shared WPF / Silverlight code?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload