如何在编辑时启用和禁用按钮? [英] How can I Enable and Disable buttons whilst editing?

查看:69
本文介绍了如何在编辑时启用和禁用按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究MVVM架构.
我在其中一列中有一个网格和一个按钮.编辑时需要启用和禁用此按钮.
保存记录后如何获取加载事件?
我需要再次将其设置为启用".

I am working on an MVVM arch.
I have a grid and a button in one of it''s columns. I need to Enable and Disable this button while editing.
How can I get it''s load event after saving my record?
I need to make it ''Enabled'' again.

推荐答案

在xaml中,添加
<Button IsEnabled="{Binding MyProperty}"/>



现在,在视图模型中实现MyProperty(使用INotifyPropertyChanged).
更改此设置将更改按钮的启用/禁用状态.



Now, implement MyProperty in the view model (using INotifyPropertyChanged).
Changing this will change the enable / disable state of the button.


这篇关于如何在编辑时启用和禁用按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆