Answer the question
In order to leave comments, you need to log in
Throws Exception when changing PropertyChanged properties?
I'm trying to create a Hamburger Menu without violating the concept of MVVM:
1. I create a variable that will be associated with the SplitView and will change the value of IsPaneOpen
private bool isPaneOpened;
public bool IsPaneOpened
{
get
{
return isPaneOpened;
}
set
{
SetProperty(ref this.isPaneOpened, value);
}
}
public ICommand PaneOpenedConvert
{
get
{
return new Command(PaneOpen);
}
}
private void PaneOpen()
{
IsPaneOpened = !IsPaneOpened;
}
System.NullReferenceException: "Object reference not set to an instance of an object."
public event PropertyChangedEventHandler PropertyChanged;
protected bool SetProperty<T>(ref T Storage, T Value, [CallerMemberName] string Propertname = null)
{
if (EqualityComparer<T>.Default.Equals(Storage, Value)) return false;
Storage = Value;
PropertyChanged(this, new PropertyChangedEventArgs(Propertname));
return true;
}
Answer the question
In order to leave comments, you need to log in
Add a question mark:
PropertyChanged?(this, new PropertyChangedEventArgs(Propertname));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question