Replace part of default template in WPF

后端 未结 4 1962
不思量自难忘°
不思量自难忘° 2020-12-04 22:14

is there any \"best practice\" way to replace a part of the default template. The current use case is a treeview. As default, the treeview has this small triangle shapes to

4条回答
  •  无人及你
    2020-12-04 22:35

    Unfortunately, I think you have to replace the entire template:

    From MSDN: http://msdn.microsoft.com/en-us/library/aa970773.aspx

    Controls in Windows Presentation Foundation (WPF) have a ControlTemplate that contains the visual tree of that control. You can change the structure and appearance of a control by modifying the ControlTemplate of that control. There is no way to replace only part of the visual tree of a control; to change the visual tree of a control you must set the Template property of the control to its new and complete ControlTemplate.

提交回复
热议问题