Quantcast
Channel: Caliburn.Micro: Xaml Made Easy
Viewing all articles
Browse latest Browse all 1760

New Post: Change Page and Update Control from property

$
0
0
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))]publicclass Page1ViewModel : BaseViewModel
    {

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

Page2View.xaml 

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

 

Page2ViewModel.cs

    [Export(typeof(Page2ViewModel))]publicclass Page2ViewModel : BaseViewModel
    {

        [ImportingConstructor]
        public Page2ViewModel()
        {
            DisplayName = "Page2";
        }
   }
BaseViewModel.cs
publicvoid changebtn()
        {
            _debug = true;
        }privatestaticbool _debug;publicbool Debug
        {get { return _debug; }set
            {if (value.Equals(_debug)) return;
                _debug = value;
                NotifyOfPropertyChange(() => Debug);
            }
        }

Viewing all articles
Browse latest Browse all 1760

Trending Articles



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