xaml – Windows 8 Metro控件的可能VisualStates在哪里记录?
发布时间:2020-12-14 04:15:57 所属栏目:Windows 来源:网络整理
导读:在为Win 8 Metro控件编写自定义ControlTemplate(XAML)时,我们需要使用VisualStateManager根据VisualState转换更新控件.我在MSDN上看到下面的示例,但是我找不到VisualStateGroup“CommonStates”的文档,除了“PointerOver”和“Normal”之外还定义了哪些其他V
在为Win 8 Metro控件编写自定义ControlTemplate(XAML)时,我们需要使用VisualStateManager根据VisualState转换更新控件.我在MSDN上看到下面的示例,但是我找不到VisualStateGroup“CommonStates”的文档,除了“PointerOver”和“Normal”之外还定义了哪些其他VisualStates?您是否需要深入了解SDK以找到按钮的默认ControlTemplate?如果是这样,在哪里?
<ControlTemplate TargetType="Button"> <Grid > <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualStateGroup.Transitions> <!--Take one half second to transition to the PointerOver state.--> <VisualTransition To="PointerOver" GeneratedDuration="0:0:0.5"/> </VisualStateGroup.Transitions> <VisualState x:Name="Normal" /> <!--Change the SolidColorBrush,ButtonBrush,to red when the Pointer is over the button.--> <VisualState x:Name="PointerOver"> <Storyboard> <ColorAnimation Storyboard.TargetName="ButtonBrush" Storyboard.TargetProperty="Color" To="Red" /> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid.Background> <SolidColorBrush x:Name="ButtonBrush" Color="Green"/> </Grid.Background> </Grid> </ControlTemplate>
您可以转到xaml文件的设计视图,并选择Button控件 – 右键单击??/编辑模板/编辑当前 – 将获取提取的默认模板.通常,控件应该使用属性来注释,这些属性指示应该在模板中使用哪些视觉状态,如下所示,但是当我导航到像Button这样的控件的定义时,我看不到它们.
[TemplateVisualState(GroupName="CommonStates",Name="Normal")] [TemplateVisualState(GroupName="CommonStates",Name="PointerOver")] (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 设置windows service方式启动GitBlit
- windows-server-2008 – 使Windows Server 2008定期更新Int
- windows – 有谁知道powershell证书提供程序路径如何映射到
- emacs – Windows配置到寄存器
- windows – 如何获取工作目录哈希确认所有未提交的更改?
- 在windows上的mongorc中设置mongodb编辑器路径
- 如何判断我的Windows服务器是否在交换?
- windows – 如何将远程服务器上的NTFS分区添加到VMWare ESX
- Windows下安装及使用NVM
- windows-8 – Windows 8调度程序中Command命令参数的最大长