我正在绑定我的命令,例如:
<Button Command="{Binding NextCommand}"
CommandParameter="Hello"
Content="Next" />
在这里,我还绑定了它的 CommandParameter 属性,现在如何从 NextCommand 中获取它的值。
public ICommand NextCommand
{
get
{
if (_nextCommand == null)
{
_nextCommand = new RelayCommand(
param => this.DisplayNextPageRecords()
//param => true
);
}
return _nextCommand;
}
}
其功能定义:
public ObservableCollection<PhonesViewModel> DisplayNextPageRecords()
{
//How to fetch CommandParameter value which is set by
//value "Hello" at xaml. I want here "Hello"
PageNumber++;
CreatePhones();
return this.AllPhones;
}
如何获取 CommandParameter 值?
提前致谢。