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

Problem Accessing Property from different class... UI is not Updating [MVVM]

$
0
0

Problem Accessing Property from different class...

UI is not Updating [MVVM]

1. I am Trying to Access IsEnabled Property from Different Class. (MVVM)

public class FirstScreeenViewModel : INotifyPropertyChanged
{

 TwoClassInteraction _sc = new TwoClassInteraction();
  public FirstScreeenViewModel()
{
 ControlEnabled = _sc.ControlEnabled;
}
 private bool _controlEnabled;

  public bool ControlEnabled
        {
            get => _controlEnabled;
            set
            {
                _controlEnabled = value;
                Selectedhandbuger = false;
                OnPropertyChanged(nameof(ControlEnabled));
            }
        }

}

  public class TwoClassInteraction : Basepropertychangedevent
    {
        private bool _controlEnabledproperty;
        public bool ControlEnabled
        {
            get => _controlEnabledproperty;
            set
            {
                if (_controlEnabledproperty == value) return;
                _controlEnabledproperty = value;

                OnPropertyChanged("ControlEnabled");
            }
        }
    }

Now I am Accessing from Third Class

  public class ThirdClassInteraction : Basepropertychangedevent
    {
public void Test()
{

var mm = new TwoClassInteraction();
mm.ControlEnabled = false;
}

}

But UI is Not Updating...... IsEnabled="{Binding ControlEnabled}"

My Requirement is Simple..

Change Property value from Multiple class and UI Should be Reflected 




Viewing all articles
Browse latest Browse all 18858

Trending Articles



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