Noo*_*per 0 c# silverlight wpf mvvm
我在SL/WPF中经历了一些MVVM示例,这里最基本的是实现ICommand接口.我已经理解了MVVM的工作原理.但是,我Execute对ICommand接口方法有疑问.
实现的类ICommand具有Execute如下所示的方法.
public void Execute(object parameter) //Method to call when the command is invoked
{
// pointer to a method to be executed
}
Run Code Online (Sandbox Code Playgroud)
在每个例子中,我都看到上面方法中的参数是NULL.为什么?有人可以发布一个MVVM的简单示例,其中使用此对象参数而不是null吗?
在XAML中,您可以设置CommandParameter
<Button Command="{Binding MyCommand}" CommandParameter="SomeData" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
390 次 |
| 最近记录: |