所谓的潇洒

导航

复合命令

    public class ViewAViewModel : BindableBase
    {
        private string _message;
        public string Message
        {
            get { return _message; }
            set { SetProperty(ref _message, value); }
        }

        public ViewAViewModel()
        {
            Message = "View A from your Prism Module";

            Command1 = new DelegateCommand(() => { Message = "CMD1 "; });
            Command2 = new DelegateCommand(() => { Message += "CMD2 "; });
            OpenAll = new CompositeCommand();
            OpenAll.RegisterCommand(Command1);
            OpenAll.RegisterCommand(Command2);
        }

        public DelegateCommand Command1 { get; private set; }
        public DelegateCommand Command2 { get; private set; }
        public CompositeCommand OpenAll { get; private set; }
    }

 

posted on 2023-03-19 18:07  所谓的潇洒  阅读(20)  评论(0编辑  收藏  举报