通过WPF样式或触发器设置TaskbarItemInfo
发布时间:2020-12-14 05:36:03 所属栏目:Windows 来源:网络整理
导读:WPF 4包含一个“TaskbarItemInfo”Freezable类,它向Window添加一个附加属性,允许更改各种 Windows 7任务栏项. 特别是,我正在尝试在窗口的tasbar图标上设置进度信息.我想使用DataTrigger执行此操作,但它似乎不起作用.我尝试使用一个简单的样式设置器,但这也不
WPF 4包含一个“TaskbarItemInfo”Freezable类,它向Window添加一个附加属性,允许更改各种
Windows 7任务栏项.
特别是,我正在尝试在窗口的tasbar图标上设置进度信息.我想使用DataTrigger执行此操作,但它似乎不起作用.我尝试使用一个简单的样式设置器,但这也不起作用 – 只有直接属性赋值或直接属性绑定才有效. 例如: <Window.Style> <Style> <Setter Property="TaskbarItemInfo.ProgressState" Value="Indeterminate" /> </Style> </Window.Style> <Window.TaskbarItemInfo> <TaskbarItemInfo /> </Window.TaskbarItemInfo> 似乎附加属性没有通过样式设置.我通过样式设置附加属性的语法不正确,还是我错过了其他内容? 解决方法
TaskbarItemInfo不从FrameworkElement继承,因此您无需在DataTrigger中设置Style属性.
为什么不将TaskbarItemInfo的ProgressState绑定到您想要在DataTrigger中使用的属性,然后使用ValueConverter将其转换为相关的TaskbarItemProgressState. <Window.TaskbarItemInfo> <TaskbarItemInfo ProgressState="{Binding YourProperty,Mode=OneWay,Converter={StaticResource ProgressStateConverter}}" /> </Window.TaskbarItemInfo> 然后,一个简单的转换器可以返回任何TaskbarItemProgressState应用于您的触发器属性. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- windows-phone – WP8上的IE 10忽略了媒体查询?
- 在Windows上使用PHP时,更好的是(1)SQL Server的本机驱动程序
- windows – 为什么我的Ruby线程演示不使用两个内核?
- Windows上的UDP多播故障排除
- windows-xp – 将Windows休眠文件移动到其他驱动器
- F12在Windows 7/8上的Delphi调试器中不起作用
- windows-7 – 我应该切换到Windows 7进行主要开发吗?
- Win10操作系统无法访问局域网共享文件夹的问题
- windows-mobile – 如何检测移动设备上的ActiveSync连接?
- windows-phone-7.1 – 将免费的Windows手机应用程序更改为付
推荐文章
站长推荐
- 如何让Windows SCM在失败时重启我的服务
- Windows Phone 8.1应用程序的XAML中不支持Suppor
- mosquitto(windows)作为broker,paho作为client
- windows-8 – 适用于Windows 8桌面的虚拟光传感器
- wpf – ShowDialog使应用程序窗口从Windows的Alt
- Windows本地搭建Edusoho环境
- windows – 通过批处理文件在GIT中创建已修改文件
- windows-installer – Windows Installer总是说“
- windows-7 – WPA2 Personal – 通过GPO部署
- microsoft-metro – 平铺中的Appname – 更新
热点阅读