I have a C# Windows Phone 8 MVVM app with the Fody PropertyChanged package installed. I have added the ImplementPropertyChanged directive before the class declaration:
[CompilerGenerated]
[GeneratedCode("Radarc", "4.0")]
[ImplementPropertyChanged]
public partial class MilitaryRobots_VideosViewModel : ViewModelsBase.VMBase, IViewModels.IMilitaryRobots_VideosViewModel, INotifyPropertyChanged
I have the following two properties in the class that I bind View elements to:
private Visibility _showDetailsVideo = Visibility.Collapsed;
public Visibility ShowDetailsVideo
{
get
{
return this._showDetailsVideo;
}
set
{
this._showDetailsVideo = value;
this.ShowMainScreen = value == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;
}
}
private Visibility _showMainScreen = Visibility.Visible;
/// <summary>
/// Never set this property, instead set ShowDetailsVideo instead.
/// </summary>
public Visibility ShowMainScreen
{
get
{
return this._showMainScreen;
}
private set
{
this._showMainScreen = value;
}
}
One View element's Visibility property is bound to the View Model's ShowDetailsVideo property. Another View element's Visibility property is bound to the View Model's ShowMainScreen property. At runtime both property getters are accessed indicating that the pair of bound View elements are accessing the properties at least once. Also, the two View elements do have the proper Visibility states. However if I change the ShowDetailsVideo property at runtime, the setters are accessed but not the getters, indicating the wiring between the properties and the view element properties isn't working, despite my use of the Fody PropetyChanged package. The property access behavior is the same as if the Fody package wasn't even there.
How can I fix this and get it working so the view elements pair of Visibility properties are updated properly at runtime? I thought the Fody PropertyChanged package was supposed to make implementing property change notification unnecessary.