Reputation: 352
I have user control which define custom style for the telerik's control RadTreeViewItem
. The problem is that when I don't have x:key there isn't any errors but when I add the x:key property I've got error "The resource "RadTreeViewItemStyle" could not be resolved.
"
<ResourceDictionary>
<Style x:Key="MySuperGoodStyle" TargetType="telerik:RadTreeViewItem" BasedOn="{StaticResource RadTreeViewItemStyle}">
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
</Style>
</ResourceDictionary>
In runtime there isn't any problems, the style works fine as expected so it looks like design only error.
Upvotes: 1
Views: 136
Reputation: 34
try to add this before :
<Style TargetType="telerik:RadTreeViewItem" x:Key="RadTreeViewItemStyle">
<Setter Property="FocusVisualStyle" Value="{StaticResource TreeviewFocusVisual}"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="1 4 5 4"/>
<Setter Property="MinHeight" Value="24"/>
<Setter Property="IsDropAllowed" Value="True"/>
<Setter Property="IsEnabled" Value="True"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="telerik:DragDropManager.TouchDragTrigger" Value="TapAndHold"/>
<Setter Property="KeyboardNavigation.TabNavigation" Value="Local"/>
<Setter Property="Template" Value="{StaticResource TreeViewItemDefaultTemplate}"/>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<telerik:TreeViewPanel VerticalAlignment="Bottom"/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</Style>
and be sure to have in your header :
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
Upvotes: 1