Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: Share ViewModels

$
0
0
Hello, Thanks for reply,

For example, we have two modules and each module a viewmodel we now how to share viewmodels if clicked save button all property save to xml format.

Modules1
namespace Modules.VM1.ViewModels
{
    [Export]
    [PartCreationPolicy(CreationPolicy.Shared)]
    public class VM1ViewModel : Infrastructure.ViewModels.NavigationAwareDataViewModel
    {
        [ImportingConstructor]
        public VM1ViewModel()
        {

        }

        private bool _isCheckBox;
        public bool IsCheckBox
        {
            get { return _isCheckBox; }
            set
            {
                _isCheckBox= value;
                this.RaisePropertyChanged(() => IsCheckBox);
            }
        }
}
Modules2
namespace Modules.VM2.ViewModels
{
    [Export]
    [PartCreationPolicy(CreationPolicy.Shared)]
    public class VM2ViewModel : Infrastructure.ViewModels.NavigationAwareDataViewModel
    {
        [ImportingConstructor]
        public VM2ViewModel()
        {

        }

        private bool _isRadioButton;
        public bool IsRadioButton
        {
            get { return _isRadioButton; }
            set
            {
                _isRadioButton= value;
                this.RaisePropertyChanged(() => IsRadioButton);
            }
        }
}

Viewing all articles
Browse latest Browse all 1878

Trending Articles



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