本文只谈在后台xaml.cs中的绑定,不讨论前台xaml中的绑定。代码为片段式,表意即可
按照命令的声明及在后台cs中的调用,直接上代码了。
1. VM中声明
#region 绑定通知
///
/// 点击密码重置时的通知
///
public RelayCommand Reset_Click { private set; get; }
#endregion View Code
2.VM中绑定函数
#region 构造函数
///
/// Initializes a new instance of the UsermanageViewModel class.
///
public UserManageViewModel()
{
this.Reset_Click = new RelayCommand(PasswordReset);
}
#endregion View Code
3.VM中创建对应函数
1 #region 绑定命令
2 private void PasswordReset()
3 {
4 MessageBox.Show("功能建设中");
5 }
6 #endregion View Code
4.后台代码xaml.cs中调用
((UserManageViewModel)this.DataContext).Reset_Click.Execute(null); View Code
最后
以上就是殷勤白云最近收集整理的关于mvvm绑定checkbox wpf_[WPF]MVVM模式下如何在后台cs中调用绑定命令的全部内容,更多相关mvvm绑定checkbox内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复