应用不透明覆盖层进行控制
我有一个控制数据模板。它背后的视图模型有一个属性 IsReadyForUse。当此属性为 false 时,我想要在控件上有一个半透明的覆盖层。此覆盖必须防止用户编辑控件上的任何项目。一旦属性恢复为 True,覆盖层就会消失。
如果有人能指出我正确的方向,我可以从那里找出答案,但我现在有点卡住了。我知道如何使用模板数据触发器,但不知道该触发器要做什么:)
提前致谢!
I have a control data template. The viewmodel behind it has a property IsReadyForUse. When this property is false, i want a semi transparent overlay on the control. This overlay must prevent the user from editing any of the items on the control. Once the property goes back to True, the overlay should dissappear.
If someone could point me in the the right direction i can figure it out from there, but i am a little stuck at the moment. I know how to use template data triggers, but dont know what to make that trigger do :)
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以创建叠加层,并使用 BooleanToVisibility 转换器将其 Visibility 属性绑定到 ViewModel 的 IsReadyForUse 属性(确保实现 INotifyPropertyChanged )。您还可以将控件的 IsEnabled 属性绑定到 ViewModel 中的同一属性。
You could create your overlay, and bind it's Visibility property to your ViewModel's IsReadyForUse property (make sure you implement
INotifyPropertyChanged
), using the BooleanToVisibility converter. You could also bing the control's IsEnabled property to the same property in the ViewModel.