我试图让我的资源字典中的特定模板。这是我的资源字典Silverlight 4.0:DataTemplate错误
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:view="clr-namespace:Test.Layout.View"
xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><DataTemplate x:Key="LeftRightLayout">
<toolkit:DockPanel>
<view:SharedContainerView toolkit:DockPanel.Dock="Left"/>
<view:SingleContainerView toolkit:DockPanel.Dock="Right"/>
</toolkit:DockPanel>
</DataTemplate>
但是当它到达XamlReader.Load
private static ResourceDictionary GetResource(string resourceName)
{
ResourceDictionary resource = null;
XDocument xDoc = XDocument.Load(resourceName);
resource = (ResourceDictionary)XamlReader.Load(xDoc.ToString(SaveOptions.None));
return resource;
}
类型 'SharedContainerView' 没有被发现,因为“CLR的命名空间:Test.Layout.View'是一个未知的命名空间。 [Line:4 Position:56]
我有同样的问题。你找到了解决这个问题的方法吗? – Gaby 2011-07-25 12:42:54
@Gaby还没有.. – xscape 2011-07-25 13:17:27