当前位置:网站首页>Controltemplate in WPF

Controltemplate in WPF

2022-06-11 00:58:00 Nidhogg_ com

WPF Medium ControlTemplate
WPF Contains data templates and control templates , The control template also includes ControlTemplate and ItemsPanelTemplate, Let's talk about ControlTemplate.
Actually WPF Each control of the has a default template , This template describes the appearance of the control ( Visual tree ) as well as The response of appearance to external stimuli ( trigger ). We can customize a template to replace the control Default templates to create personalized controls .
And Style Different ,Style Only the existing property values of the control can be changed ( Such as color font ) To customize the controls , But the control module The board can change the internal structure of the control (VisualTree, Visual tree ) To complete more complex customization , For example, we can To customize such buttons : It displays a small icon in the left part and text in the right part . want Replace the template of the control , We just need to declare one ControlTemplate object , And ControlTemplate Yes Like making corresponding configuration , Then the ControlTemplate Object assigned to the control Template Properties will do .
ControlTemplate Contains two important properties :
1, VisualTree, The visual tree of the template , In fact, we use this property to describe the appearance of the control
2, 2, Triggers, Trigger list , It contains some triggers Trigger, We can customize this trigger column Table to make the control respond to external stimuli , For example, the text becomes bold when the mouse passes .

Blend for Visual Studio summary Blend for Visual Studio
Can be used to design based on XAML Of Windows and Web Applications . It provides And Visual studio Same basic XAML Design experience , And added a visual designer , For senior positions service , Such as animation and behavior . of Blend and Visual Studio Comparison between , Please refer to at Visual Studio and Blend for Visual Studio Middle design XAML.
Blend for Visual Studio yes Visual Studio A component of . If you want to install Blend, Please be there. Visual Studio In setup , choice “ Universal Windows Platform development ” or “.NET Desktop development ” The workload . These two Both workloads include Blend for Visual Studio Components .

原网站

版权声明
本文为[Nidhogg_ com]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020626176226.html