示例#1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var w  = new MainDataView();
            var vm = new MainDataViewModel();

            w.DataContext = vm;
            w.Show();
        }
示例#2
0
        protected override void OnDataContextChanged(EventArgs e)
        {
            if (_model != null)
            {
                _model.View = null;
            }
            _model = DataContext as MainDataViewModel;
            if (_model != null)
            {
                _model.View = this;
            }

            base.OnDataContextChanged(e);
        }