14
में CommandParameter मूल्य प्राप्त
मैं तरह मेरे आदेश बाध्यकारी हूँ:MVVM
<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 मूल्य लाने के लिए?
अग्रिम धन्यवाद।
आप बहुत बहुत शुक्रिया, इसकी बहुत काम कर रहे। फिर से धन्यवाद। –
और फिर आप '_nextCommand = new RelayCommand (this.DisplayNextPageRecords) जैसे उपयोग कर सकते हैं;' –