14
Estoy vinculantes mi comando como:Recibir CommandParameter Valor en MVVM
<Button Command="{Binding NextCommand}"
CommandParameter="Hello"
Content="Next" />
Aquí, también, ato su propiedad CommandParameter, ahora la forma de buscar a su valor de NextCommand.
public ICommand NextCommand
{
get
{
if (_nextCommand == null)
{
_nextCommand = new RelayCommand(
param => this.DisplayNextPageRecords()
//param => true
);
}
return _nextCommand;
}
}
Su definición de función:
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;
}
¿Cómo se ha podido recuperar el valor CommandParameter?
Gracias de antemano.
Muchas gracias, está trabajando mucho. Gracias de nuevo. –
y luego puede usar como '_nextCommand = new RelayCommand (this.DisplayNextPageRecords);' –