Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are applying the "treeViewItemStyle" only to the first level of items in the TreeView. You have to set it as well as the ItemContainerStyle of the TreeViewItems. So, in your ControlTemplate, you'll need something like:</p> <pre><code>&lt;ControlTemplate TargetType="TreeViewItem"&gt; &lt;TreeViewItem ItemContainerStyle="{StaticResource treeViewItemStyle}".../&gt; &lt;/ControlTemplate&gt; </code></pre> <p>Better yet, you can just remove the "x:Key" attribute in your Style declaration. Doing so will automatically apply the style to <strong>all</strong> TreeViewItems.</p> <p><em>SIDE NOTE:</em></p> <p>I would suggest that instead of overriding the ControlTemplate like what you did above, just use property Setters in the Style instead. Something like:</p> <pre><code>&lt;Style TargetType="TreeViewItem"&gt; &lt;Setter Property="IsExpanded" Value="{Binding Path=IsExpanded, Mode=TwoWay}"/&gt; &lt;Setter Property="ItemsSource" Value="{Binding Path=SubCategories}"/&gt; &lt;Setter Property="ItemTemplate" Value="{StaticResource menuHierarchicalTemplate}"/&gt; &lt;Setter Property="Header"&gt; &lt;Setter.Value&gt; &lt;StackPanel Orientation="Horizontal" &gt; &lt;TextBlock Height="24" FontSize="12" Padding="5" Text="{Binding Path=Name}" /&gt; &lt;/StackPanel&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre> <p>It's quite unusual to use the same Control as part of the ControlTemplate of itself (i.e. using TreeViewItem in the ControlTemplate of a TreeViewItem).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload