Change Page and Update Control from property

Nov 28, 2012 at 6:24 AM
Edited Nov 28, 2012 at 7:14 AM
I'm Click Button and changing page in tabcontrol not update control from property,
Please help me.

ShellViewModel.cs

        [ImportingConstructor]
        public ShellViewModel(IEventAggregator eventAggregator,Page1ViewModel page1,Page2ViewModel page2)
        {
            EventAggregator = eventAggregator;

            Items.Add(page1);
            Items.Add(page2);

            ActivateItem(page1);
        }

 

Page1View.xaml

<Button x:Name="changebtn" >

 

Page1ViewModel.cs

    [Export(typeof(Page1ViewModel))]
    public class Page1ViewModel : BaseViewModel
    {

        [ImportingConstructor]
        public Page1ViewModel()
        {
            DisplayName = "Page1";
        }

Page2View.xaml 

<CheckBox Content="Debug" IsChecked="{Binding Debug, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>

 

Page2ViewModel.cs

    [Export(typeof(Page2ViewModel))]
    public class Page2ViewModel : BaseViewModel
    {

        [ImportingConstructor]
        public Page2ViewModel()
        {
            DisplayName = "Page2";
        }
   }
BaseViewModel.cs
        public void changebtn()
        {
            _debug = true;
        }

        private static bool _debug;
        public bool Debug
        {
            get { return _debug; }
            set
            {
                if (value.Equals(_debug)) return;
                _debug = value;
                NotifyOfPropertyChange(() => Debug);
            }
        }