Ejemplo n.º 1
0
 public void Add(DockWindowViewModel viewModel)
 {
     viewModel.PropertyChanged += ViewModel_PropertyChanged;
     if (!viewModel.IsClosed)
     {
         Documents.Add(viewModel);
     }
 }
Ejemplo n.º 2
0
        private MenuItemViewModel GetMenuItemViewModel(DockWindowViewModel dockWindowViewModel)
        {
            var menuItemViewModel = container.Resolve <MenuItemViewModel>();

            menuItemViewModel.IsCheckable = true;
            menuItemViewModel.Header      = dockWindowViewModel.Title;
            menuItemViewModel.IsChecked   = !dockWindowViewModel.IsClosed;

            dockWindowViewModel.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == nameof(DockWindowViewModel.IsClosed))
                {
                    menuItemViewModel.IsChecked = !dockWindowViewModel.IsClosed;
                }
            };
            menuItemViewModel.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == nameof(MenuItemViewModel.IsChecked))
                {
                    dockWindowViewModel.IsClosed = !menuItemViewModel.IsChecked;
                }
            };
            return(menuItemViewModel);
        }