public void Loaded(ViewLoadedParams p) { ViewModel = new NodePropertyPaletteWindowViewModel(p); NodePropertyPaletteView = new NodePropertyPaletteWindow(p, ViewModel) { // Set the data context for the main grid in the window. NodesTable = { DataContext = ViewModel }, MainGrid = { DataContext = ViewModel }, Owner = p.DynamoWindow }; NodePropertyPaletteMenuItem = new MenuItem { Header = "Show NodePropertyPalette", IsCheckable = true, IsChecked = false }; NodePropertyPaletteMenuItem.Click += (sender, args) => { if (NodePropertyPaletteMenuItem.IsChecked) { p.AddToExtensionsSideBar(this, NodePropertyPaletteView); } else { p.CloseExtensioninInSideBar(this); } }; p.AddMenuItem(MenuBarType.View, NodePropertyPaletteMenuItem); }
/// <summary> /// Create the NodePropertyPalette Window /// </summary> /// <param name="vlp"></param> public NodePropertyPaletteWindow(ViewLoadedParams vlp, NodePropertyPaletteWindowViewModel vm) { InitializeComponent(); viewLoadedParams = vlp; // Initialize the height of the datagrid in order to make sure // vertical scrollbar can be displayed correctly. this.NodesTable.Height = vlp.DynamoWindow.Height - sidebarHeightOffset; vlp.DynamoWindow.SizeChanged += DynamoWindow_SizeChanged; commandExecutive = vlp.CommandExecutive; viewModelCommandExecutive = vlp.ViewModelCommandExecutive; viewModel = vm; }