简体   繁体   English

如何在XAML中将自定义样式/模板应用于treeviewItem

[英]How to apply a custom style/template to a treeviewItem in xaml

So I have editted the TreeViewItem template, (so that I could get rid of the checkbox). 因此,我已经编辑了TreeViewItem模板,(以便摆脱该复选框)。

I was just wondering how I can apply this template to my treeview...The Treeview is databound. 我只是想知道如何将该模板应用于树视图...树视图是数据绑定的。

is it something like: 是这样的吗:

<TreeView>
<TreeView.ItemTemplate>
....
...

?

Thanks! 谢谢!

Use the ItemContainerStyle of the TreeView . 使用TreeViewItemContainerStyle Or apply it implicitly by having it defined in the resources with only the TargetType set (this could be superior as the ItemContainerStyle may only affect the root items). 或通过仅在TargetType集中在资源中定义它来隐式应用它(这可能会更好,因为ItemContainerStyle可能只影响根项目)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM