Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Data bound view elements still not updating despite the use of Fody PropertyChanged package in Windows Phone 8 app?

$
0
0
I have a C# Windows Phone 8 MVVM app with the Fody PropertyChanged package installed.  I have added theImplementPropertyChanged 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 different Viewelements 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 theView Model'sShowDetailsVideo property.  AnotherView element's Visibility property is bound to theView Model's ShowMainScreen property.  At runtime both propertygetters are accessed indicating that the pair of bound View elements  are accessing the properties at least once.  Also, the twoView elements do have the proper Visibility states. However if I change theShowDetailsVideo property at runtime, the setters are accessed butnot the getters, indicating the wiring between the properties and the view element properties isn't working, despite my use of theFody 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 theFody PropertyChanged package was supposed to make implementing property change notification unnecessary.

-- roschler



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>