Problems with CUSTOM TEMPLATE in SILVERLIGHT
I have problems with creating my own template from resource dictionary . It shows me exception : Error [Line : 0 Position : 0] . I can't find the error . Here is my source :
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:oktaCMS.Menu">
<!-- RIBBON PANEL TEMPLATE -->
<Style x:Key="RibbonPanelTemplate" TargetType="local:RibbonPanel">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:RibbonPanel">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="DefaultStates">
<VisualState x:Name="MouseOver" />
<VisualState x:Name="Norm开发者_Python百科al"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border BorderBrush="#FFE2DFEF" BorderThickness="1" Margin="0" CornerRadius="4">
<Grid>
<Grid x:Name="ContentArea" Margin="0,0,0,20" Background="Transparent"/>
<Border BorderBrush="#FFE2DFEF" BorderThickness="0,1,0,0" Margin="0" VerticalAlignment="Bottom" Height="20" CornerRadius="0,0,4,4" Background="#FFD1CDE6">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</Grid>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
If you are loading the XAML dynamically using XamlReader.Load(), then you probably need to qualify your "local" namespace with the full name of your assembly (not just the clr namespace).
E.g. change this:
xmlns:local="clr-namespace:oktaCMS.Menu"
to something like this:
xmlns:local="clr-namespace:oktaCMS.Menu;assembly=MyAssemblyName"
精彩评论