博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
How to Notify Command to evaluate in mvvmlight
阅读量:4590 次
发布时间:2019-06-09

本文共 880 字,大约阅读时间需要 2 分钟。

How to Raize Command to evalituate in mvvm

  1. In mvvmlight, we bind our control to the relaycommand object. But, the commmand only execute the CanExecute() onetime, if some specifies changed, how could we notify the control to re-evaluate.
    Im mvvm light, we can find, two elements in RelayCommand: event CanExecuteChanged, RaiseCanExecuteChagned(), so we can add our customized event handles to the event, and we can call the RaiseCanExecuteChanged() function to raise the event,

Sample code:

public int Index    {        get        {            return _index;        }        set        {            _index = value;            RaisePropertyChanged("");            ((RelayCommand
)BackCommand).RaiseCanExecuteChanged(); ((RelayCommand
)NextCommand).RaiseCanExecuteChanged(); } }

转载于:https://www.cnblogs.com/kongshu-612/p/5539472.html

你可能感兴趣的文章
学习随笔(2017-1-10)
查看>>
jieba学习
查看>>
单例模式(Singleton Pattern)
查看>>
再谈async与await
查看>>
无根树转有根树
查看>>
for循环:用turtle画一颗五角星
查看>>
协方差的意义和计算公式(转)
查看>>
Restful规范
查看>>
趣图:正在调试,突然内存溢出了
查看>>
SSH免密码远程登录Linux
查看>>
网络数据处理
查看>>
传输层TCP和UDP的区别分析与应用场景
查看>>
React Native安装
查看>>
神经网络详解
查看>>
利用Abot 抓取博客园新闻数据
查看>>
HTTP 协议中 URI 和 URL 有什么区别?
查看>>
Linux -- passwd
查看>>
接口测试基础篇
查看>>
LeetCode 102. 二叉树的层次遍历
查看>>
CCF | 小中大
查看>>