예제 #1
0
        /*static ObservableCollection<DesktopPanelBaseViewModel> PanelsViewModels
         *  = new ObservableCollection<DesktopPanelBaseViewModel>();
         */

        public static DesktopPanelBase AddDesktopPanel(
            DockName dock     = DockName.Left,
            ScreenInfo screen = null)
        {
            var panel = new DesktopPanelBase();

            PanelsViewModels.Add(panel.ViewModel);
            if (dock != DockName.None)
            {
                void attachMethod(object o, DependencyPropertyChangedEventArgs e)
                {
                    panel.IsVisibleChanged -= attachMethod;
                    panel.ViewModel.AttachToDock(dock, screen);
                }

                panel.IsVisibleChanged += attachMethod;
            }
            return(panel);
        }