Note that there are some explanatory texts on larger screens.

plurals
  1. POTreeViewItem not selectible with datacontext
    text
    copied!<p>When I set the treeviewitem's header via a DataContext, it adds a few pixels of padding that are clickable, and then puts the text with isn't clickable. I shall post an image; blue: clickable, red: unclickable.</p> <p><img src="https://i.stack.imgur.com/c9PAP.png" alt=""></p> <p>The classes that store the data:</p> <pre><code>public class TagClass { public string TagClassMagic { get; set; } public ITagClass RawClass { get; set; } public List&lt;TagEntry&gt; TagEntries = new List&lt;TagEntry&gt;(); public IList Children { get { return new CompositeCollection() { new CollectionContainer() { Collection = TagEntries } }; } } } public class TagEntry { public string TagFileName { get; set; } public ITagEntry RawTag { get; set; } } </code></pre> <p>The XAML for displaying the Data:</p> <pre><code>&lt;TreeView x:Name="tvTagList" Margin="15, 40, 15, 50" ItemsSource="{Binding}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="{x:Null}" BorderBrush="{DynamicResource ExtryzeAccentBrushSecondary}" BorderThickness="2" ScrollViewer.CanContentScroll="True" Foreground="White"&gt; &lt;TreeView.Resources&gt; &lt;HierarchicalDataTemplate DataType="{x:Type DataBind:TagClass}" ItemsSource="{Binding Children}" &gt; &lt;TreeViewItem Header="{Binding TagClassMagic}" /&gt; &lt;/HierarchicalDataTemplate&gt; &lt;HierarchicalDataTemplate DataType="{x:Type DataBind:TagEntry}" &gt; &lt;TreeViewItem Header="{Binding TagFileName}" /&gt; &lt;/HierarchicalDataTemplate&gt; &lt;/TreeView.Resources&gt; &lt;/TreeView&gt; </code></pre>
 

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