In my TreeViewDictionary.xaml i have defined the style as below. Its a Resource Dictionary file for reuse. How do i refer this treeviewitem in view . When i refer it using ItemCcontainerStyle of TreeView, it throws below error :
<Treeview ItemContainerStyle="{StaticResource treeViewDictionary}"/>
An unhandled exception of type 'System.InvalidOperationException' occurred in WindowsBase.dllAdditional information: '{DependencyProperty.UnsetValue}' is not a valid value for property 'Margin'.
<converters:ContextMenuConverter x:Key="contextMenuConverter"/><Style TargetType="{x:Type TreeViewItem}" x:Key="treeViewDictionary"><Setter Property="ContextMenu" Value="{Binding Converter={StaticResource contextMenuConverter}}"/><Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" /><Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" /><Setter Property="FontWeight" Value="Normal" /><Style.Triggers><Trigger Property="IsSelected" Value="True"><Setter Property="FontWeight" Value="Bold" /></Trigger></Style.Triggers></Style>
Krrishna