Tôi đang cố gắng lấy mẫu cụ thể trong từ điển tài nguyên của mình. Đây là từ điển tài nguyên của tôiSilverlight 4.0: Lỗi 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>
Tuy nhiên khi nó được cho 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;
}
Loại 'SharedContainerView' không tìm thấy vì 'clr-namespace : Test.Layout.View 'là một không gian tên không xác định. [Dòng: 4 Vị trí: 56]
Tôi gặp vấn đề tương tự. Bạn đã tìm thấy một cách để giải quyết vấn đề này? – Gaby
@Gaby chưa .. – xscape