Silverlight 4.0: DataTemplate Error

Posted by xscape on Stack Overflow See other posts from Stack Overflow or by xscape
Published on 2010-04-30T00:39:11Z Indexed on 2010/04/30 0:47 UTC
Read the original article Hit count: 581

Im trying to get the specific template in my resource dictionary. This is my resource dictionary

<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>

However when it gets to 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;
    }

The type 'SharedContainerView' was not found because 'clr-namespace:Test.Layout.View' is an unknown namespace. [Line: 4 Position: 56]

© Stack Overflow or respective owner

Related posts about silverlight-4.0

Related posts about datatemplate