void open_Click(object sender, RoutedEventArgs e) { var node = this.DataContext as PropertyNode; var editor = new FlatCollectionEditor(); editor.LoadItemsCollection(node.FirstProperty); editor.ShowDialog(); }
private void MainHeaderClick(object sender, RoutedEventArgs e) { var clickedOn = e.Source as MenuItem; if (clickedOn != null) { var parent = clickedOn.Parent as MenuItem; if (parent != null) { if((string)clickedOn.Header=="Edit Items") { var editor = new CollectionEditor(); var itemsControl=this.ExtendedItem.View as ItemsControl; if (itemsControl != null) editor.LoadItemsCollection(this.ExtendedItem); editor.Show(); } if((string)clickedOn.Header=="Edit Rows") { var editor = new FlatCollectionEditor(); var gd=this.ExtendedItem.View as Grid; if (gd != null) editor.LoadItemsCollection(this.ExtendedItem.Properties["RowDefinitions"]); editor.Show(); } if((string)clickedOn.Header=="Edit Columns") { var editor = new FlatCollectionEditor(); var gd=this.ExtendedItem.View as Grid; if (gd != null) editor.LoadItemsCollection(this.ExtendedItem.Properties["ColumnDefinitions"]); editor.Show(); } if (parent.Header is string && (string) parent.Header == "Change Orientation") { var value = _menu.UncheckChildrenAndSelectClicked(parent, clickedOn); if (value != null) { var orientation = Enum.Parse(typeof (Orientation), value); if (orientation != null) this.ExtendedItem.Properties[StackPanel.OrientationProperty].SetValue(orientation); } } if (parent.Header is string && (string)parent.Header == "Set Dock to") { var value = _menu.UncheckChildrenAndSelectClicked(parent, clickedOn); if(value!=null) { var dock = Enum.Parse(typeof (Dock), value); if (dock != null) this.ExtendedItem.Properties.GetAttachedProperty(DockPanel.DockProperty).SetValue(dock); } } if (parent.Header is string && (string) parent.Header == "Horizontal Alignment") { var value = _menu.UncheckChildrenAndSelectClicked(parent, clickedOn); if (value != null) { var ha = Enum.Parse(typeof (HorizontalAlignment), value); if (ha != null) this.ExtendedItem.Properties[FrameworkElement.HorizontalAlignmentProperty].SetValue(ha); } } if (parent.Header is string && (string) parent.Header == "Vertical Alignment") { var value = _menu.UncheckChildrenAndSelectClicked(parent, clickedOn); if (value != null) { var va = Enum.Parse(typeof (VerticalAlignment), value); if (va != null) this.ExtendedItem.Properties[FrameworkElement.VerticalAlignmentProperty].SetValue(va); } } } } }