Wpf user control button command is not firing in viewmodel
- by mani1985
hi,
i have a user control in which there is a button.
i wrote icommand in the viewmodel for the button to call some function.
when i use this user control in some other page ,the user control button click is not working.
my xaml
Save
my view model
private ICommand _insertNewNote;
public ICommand InsertNewNote
{
get
{
if (_insertNewNote == null)
{
_insertNewNote = new RelayCommand(
param = this.InsertNewExceptionNote());
}
return _insertNewNote;
}
}
public void InsertNewExceptionNote()
{
//...
}
my problem is when i use this user control in some page like this
the user control is getting displayed in the page. but the button in the user control is not firing when i click it.
user control view model icommand is not at all initialized.
please provide me a solution.
Thanks in advance.