I am binding my command like:
<Button Command="{Binding NextCommand}"
CommandParameter="Hello"
Content="Next" />
Here, I also bind its CommandParameter property, now how to fetch its value from NextCommand.
public ICommand NextCommand
{
get
{
if (_nextCommand == null)
{
_nextCommand = new RelayCommand(
param => this.DisplayNextPageRecords()
//param => true
);
}
return _nextCommand;
}
}
Its function definition:
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;
}
How to fetch CommandParameter value?
Thanks in advance.
_nextCommand = new RelayCommand(this.DisplayNextPageRecords);
– Fingertip