当 IsEnabled=False 时,Silverlight 工具包 Timepicker 控件不会出现视觉重影
我想知道是否有人找到了解决这个问题的方法。将 TimePicker 控件的 IsEnabled 属性设置为 false 可以正确地重影时间图标,但主时间显示根本不会重影。两个复合控件确实被禁用,因为单击两者都不会响应鼠标单击,它只是主要时间显示的视觉表示没有重影。有人成功找到解决方法吗?
谢谢。
I was wondering if anybody has found a solution to this problem. Setting the TimePicker controls IsEnabled property to false properly ghosts the time icon but the main time display does not ghost at all. Both composited controls are indeed disabled as clicking on both do not respond to mouse clicks its just the visual representation of the main time display is not ghosting. Has anybody successfully found a workaround for this?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过在 Blend 中编辑 TimeUpDownStyle 模板,无需对控件进行子类化即可完成此操作。该模板具有禁用的视觉状态,您可以使用它来将上/下区域的整个网格的不透明度设置为 35% 之类的值。
我在此处添加 XAML 以供参考,但请注意,与原始模板的唯一区别是为顶级网格指定名称
,然后更改禁用视觉状态下的不透明度:只需在 Blend 中单击几下即可轻松完成所有操作。
更新:
您可以通过引用 TimePicker 控件的 TimeUpDownStyle 属性中的资源键来使用该样式:
This can be done without subclassing the control by editing the TimeUpDownStyle template in blend. That template has a disabled visual state, and you can use it to set the opacity of the entire grid for the up/down area to something like 35%.
I'm adding the XAML here for reference, but note that the only differences from the original template are giving the top-level grid a name
<Grid x:Name="grid">
and then changing its opacity on the disabled visual state:It's a lot easier to do it all with a few clicks in Blend.
Update:
You can use the style by referencing the resource key in the TimeUpDownStyle property of the TimePicker control: