当前位置:网站首页>【WPF】VisualStateManager
【WPF】VisualStateManager
2022-04-22 05:18:00 【Pistachio 2021】
<Grid Background="Transparent">
<VisualStateManager.VisualStateGroups>
<!--VisualStateGroup: State group : Consisting of mutually exclusive states , State groups and state groups are not mutually exclusive ;-->
<VisualStateGroup x:Name="CommonState">
<!-- View state (Visual States) Represents the style of a control in a special logical state 、 appearance ;-->
<VisualState x:Name="CheckedState">
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="Background.(SolidColorBrush.Color)" To="#A1D6FC" Duration="0:0:0:1"/>
</Storyboard>
</VisualState>
<VisualState x:Name="UnCheckedState"/>
<!--Transitions: View transformation , Represents the transition of a control from one view state to another -->
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0:0:1" To="CheckState"/>
<VisualTransition GeneratedDuration="0:0:1" To="UnCheckedState"/>
</VisualStateGroup.Transitions>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<CheckBox Content=" Check box " x:Name="_checkbox">
<i:Interaction.Behaviors>
<!--DataStateBehavior: Switch between the two states according to the conditional statement -->
<ei:DataStateBehavior Binding="{Binding IsChecked,ElementName=_checkbox}" Value="True" TrueState="CheckedState" FalseState="UnCheckedState"/>
</i:Interaction.Behaviors>
</CheckBox>
</Grid>


VisualStateManager And trigger The difference between
- Trigger Is the event 、 When a property or bound data changes , Corresponding changes made ; and VisualStateManager You can freely control the switching of states , And set it at the time of switching , You can specify VisualTransition
- about Trigger, The person who defines the template is free to specify what changes should be made when the conditions are met ; And for VisualStateManager, You need the control developer to define different VisualState, Then the person who defines the template follows the Convention ( according to TemplateVisualStateAttribute characteristic ) To define styles in different states of the control ;
- VisualStateManager Not only support WPF, And it also supports UWP, We can say it's “ Cross platform ” Of , and Trigger stay UWP It's not supported
版权声明
本文为[Pistachio 2021]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210625511550.html
边栏推荐
- Go language crawler Foundation
- Chapter IX user and authority
- Unity中的UGUI源码解析之事件系统(9)-输入模块(下)
- Considerations for importing idea package and calling its methods
- [I. XXX pest detection project] 2. Trying to improve the network structure: resnet50, Se, CBAM, feature fusion
- 什么是幂等性
- Drawing scatter diagram with MATLAB
- 数据库第十三次作业 事务管理
- One way to disable Google cross domain
- Jackson
猜你喜欢

Tree array

Learning C language diary from scratch -- day27 minesweeping

MySQL double master and double slave + atlas data test

Clonal map of writing in mind

Summary of browser cross domain problems

Distributed transaction Seata

One way to disable Google cross domain
![Layer 3 switch [vlanif details] enable OSPF and router interworking [ENSP implementation]](/img/ff/587994174a0191ee9df2b8ad018eff.png)
Layer 3 switch [vlanif details] enable OSPF and router interworking [ENSP implementation]

Measuring the global recursive DNS infrastructure: a view from the edge

mysql rank() over,dense_ rank() over,row_ The difference between number () and over
随机推荐
[I. XXX pest detection project] 2. Trying to improve the network structure: resnet50, Se, CBAM, feature fusion
Typescript function generics
Request and response objects
Database (II) addition, deletion, modification and query of MySQL table (basic)
MySQL数据库第十一次
2022.2.14-2.27 responsibility chain mode
[matlab] draw Zernike polynomials
Summary of database Deadlock: (3.7-3.13)
什么是幂等性
WeChat official account looks at UIN, and it is biz after Base64.
Meetup 02期回顾:Q&A 集锦
How to restrict Oracle sub query
Learning C language diary from scratch -- day27 minesweeping
abcabc
Regular expression of shell script
Command mode (3.21-3.27)
[redis notes] data structure and object: Dictionary
The SQL backup bak in the batch compression folder is rar, and then delete the RAR 3 days ago
Mysql database for the 11th time
Remote wake-up server