G
Guest
Below is code derived from a Msdn example. The error is in the line
"<c:MyData x:Key="myDataSource"/>" at the point c:MyData. Vs2005 complains
that this is not an allowed element in that part of the Xaml. Everything else
appears to be acceptable. The SDKSample namespace is in a separate C# Dll
module called "SDKSample.dll". It is included in the Reference section of the
Wpf project. The class MyData is public and has a default constructor. The
string property is publc.
I can't find references to the specific XmlNamespace:Class usage in Msdn.
Could someone indicate what I am doing wrong?
Thanks.
<Window x:Class="Wpf6.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Canvas Sample" Width="400" Height="400"
Name="mainWindow"
<c:MyData x:Key="myDataSource"/>
</DockPanel.Resources>
<DockPanel.DataContext>
<Binding Source="{StaticResource myDataSource}"/>
</DockPanel.DataContext>
<Button Background="{Binding Path=ColorName}" Width="150" Height="30">I am
bound to be RED!</Button>
</DockPanel>
</Window>
"<c:MyData x:Key="myDataSource"/>" at the point c:MyData. Vs2005 complains
that this is not an allowed element in that part of the Xaml. Everything else
appears to be acceptable. The SDKSample namespace is in a separate C# Dll
module called "SDKSample.dll". It is included in the Reference section of the
Wpf project. The class MyData is public and has a default constructor. The
string property is publc.
I can't find references to the specific XmlNamespace:Class usage in Msdn.
Could someone indicate what I am doing wrong?
Thanks.
<Window x:Class="Wpf6.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Canvas Sample" Width="400" Height="400"
Name="mainWindow"
<DockPanel.Resources><DockPanel
xmlns:c="clr-namespace:SDKSample;assembly=SDKSample"
<c:MyData x:Key="myDataSource"/>
</DockPanel.Resources>
<DockPanel.DataContext>
<Binding Source="{StaticResource myDataSource}"/>
</DockPanel.DataContext>
<Button Background="{Binding Path=ColorName}" Width="150" Height="30">I am
bound to be RED!</Button>
</DockPanel>
</Window>