14
sto vincolanti mio comando come:Ricezione CommandParameter Value in MVVM
<Button Command="{Binding NextCommand}"
CommandParameter="Hello"
Content="Next" />
Qui, ho anche impegnare i suoi beni CommandParameter, ora come per andare a prendere il suo valore da nextCommand.
public ICommand NextCommand
{
get
{
if (_nextCommand == null)
{
_nextCommand = new RelayCommand(
param => this.DisplayNextPageRecords()
//param => true
);
}
return _nextCommand;
}
}
La sua definizione di funzione:
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;
}
Come per recuperare il valore CommandParameter?
Grazie in anticipo.
Grazie mille, funziona molto. Grazie ancora. –
e quindi è possibile utilizzare come '_nextCommand = new RelayCommand (this.DisplayNextPageRecords);' –