<Button Command="{Binding NextCommand}"
CommandParameter="Hello"
Content="Next" />
----------------------------------------------------------------------------
public ICommand NextCommand
{
get
{
if (_nextCommand == null)
{
_nextCommand = new RelayCommand(
param => this.DisplayNextPageRecords(param)
//param => true
);
}
return _nextCommand;
}
}
public ObservableCollection<PhonesViewModel> DisplayNextPageRecords(object o)
{
//现在 o 就包含了 "Hello"
PageNumber++;
CreatePhones();
return this.AllPhones;
}
本文详细介绍了如何在WPF应用中利用RelayCommand来实现页面之间的跳转,并通过CommandParameter传递参数。包括具体实现步骤、代码示例及应用场景。

9367

被折叠的 条评论
为什么被折叠?



