void BuildPropertyGrid() { dockPanel = new DockPanel {LastChildFill = true, Width = 200, Height = 400,}; wpfPropertyGrid = new WpfPropertyGrid{SelectedObject = AdornedElement, HelpVisible = true}; dockPanel.Children.Add(wpfPropertyGrid); visualChildren.Add(dockPanel); }
private static object CoerceSelectedObjects(DependencyObject d, object value) { WpfPropertyGrid pg = d as WpfPropertyGrid; object single = pg.GetValue(SelectedObjectsProperty); return(single == null ? new object[0] : value); }
private static object CoerceSelectedObject(DependencyObject d, object value) { WpfPropertyGrid pg = d as WpfPropertyGrid; object[] collection = pg.GetValue(SelectedObjectsProperty) as object[]; return(collection.Length == 0 ? null : value); }
private static void PropertySortPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { WpfPropertyGrid pg = source as WpfPropertyGrid; PropertySort sort = (PropertySort)e.NewValue; bool isAlpha = (sort == PropertySort.Alphabetical || sort == PropertySort.NoSort); pg.IsInAlphaViewMethod.Invoke(pg.Designer.PropertyInspectorView, new object[] { isAlpha }); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 3: this.PropertyGrid1 = ((System.Windows.Controls.WpfPropertyGrid)(target)); return; case 4: this.ItemList = ((System.Windows.Controls.ItemsControl)(target)); return; case 5: this.Radio1 = ((System.Windows.Controls.RadioButton)(target)); #line 35 "..\..\..\MainWindow.xaml" this.Radio1.Click += new System.Windows.RoutedEventHandler(this.SingleSelect_Click); #line default #line hidden return; case 6: this.Radio2 = ((System.Windows.Controls.RadioButton)(target)); #line 36 "..\..\..\MainWindow.xaml" this.Radio2.Click += new System.Windows.RoutedEventHandler(this.MultiSelect_Click); #line default #line hidden return; case 7: this.Radio3 = ((System.Windows.Controls.RadioButton)(target)); #line 37 "..\..\..\MainWindow.xaml" this.Radio3.Click += new System.Windows.RoutedEventHandler(this.NoSelection_Click); #line default #line hidden return; case 8: this.ShowDescrip = ((System.Windows.Controls.CheckBox)(target)); return; case 9: this.ShowToolbar = ((System.Windows.Controls.CheckBox)(target)); return; case 10: this.ComboSort = ((System.Windows.Controls.ComboBox)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.rectangle1 = ((System.Windows.Shapes.Rectangle)(target)); #line 25 "..\..\..\LaserSettings.xaml" this.rectangle1.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.rectangle1_MouseDown); #line default #line hidden return; case 2: this.button2 = ((System.Windows.Controls.Button)(target)); #line 26 "..\..\..\LaserSettings.xaml" this.button2.Click += new System.Windows.RoutedEventHandler(this.button1_Click); #line default #line hidden return; case 3: this.button1 = ((System.Windows.Controls.Button)(target)); #line 27 "..\..\..\LaserSettings.xaml" this.button1.Click += new System.Windows.RoutedEventHandler(this.button2_Click); #line default #line hidden return; case 4: this.propertyGrid = ((System.Windows.Controls.WpfPropertyGrid)(target)); return; case 5: this.label1 = ((System.Windows.Controls.Label)(target)); #line 29 "..\..\..\LaserSettings.xaml" this.label1.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.rectangle1_MouseDown); #line default #line hidden return; case 6: this.rectangle2 = ((System.Windows.Shapes.Rectangle)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.LISTENER_GROUP_BOX = ((System.Windows.Controls.GroupBox)(target)); return; case 2: this.PropertyGrid1 = ((System.Windows.Controls.WpfPropertyGrid)(target)); return; } this._contentLoaded = true; }
private static void SelectedObjectsPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { WpfPropertyGrid pg = source as WpfPropertyGrid; pg.CoerceValue(SelectedObjectsProperty); object[] collection = e.NewValue as object[]; if (collection.Length == 0) { pg.OnSelectionChangedMethod.Invoke(pg.Designer.PropertyInspectorView, new object[] { null }); pg.SelectionTypeLabel.Text = string.Empty; } else { bool same = true; Type first = null; var context = new EditingContext(); var mtm = new ModelTreeManager(context); Selection selection = null; // Accumulates the selection and determines the type to be shown in the top of the PG for (int i = 0; i < collection.Length; i++) { mtm.Load(collection[i]); if (i == 0) { selection = Selection.Select(context, mtm.Root); first = collection[0].GetType(); } else { selection = Selection.Union(context, mtm.Root); if (!collection[i].GetType().Equals(first)) { same = false; } } } pg.OnSelectionChangedMethod.Invoke(pg.Designer.PropertyInspectorView, new object[] { selection }); pg.SelectionTypeLabel.Text = same ? first.Name + " <multiple>" : "Object <multiple>"; } pg.ChangeHelpText(string.Empty, string.Empty); }
private static void HelpVisiblePropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { WpfPropertyGrid pg = source as WpfPropertyGrid; if (e.NewValue != e.OldValue) { if (e.NewValue.Equals(true)) { pg.RowDefinitions[1].Height = new GridLength(5); pg.RowDefinitions[2].Height = new GridLength(pg.HelpTextHeight); } else { pg.HelpTextHeight = pg.RowDefinitions[2].Height.Value; pg.RowDefinitions[1].Height = new GridLength(0); pg.RowDefinitions[2].Height = new GridLength(0); } } }
private static void SelectedObjectPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { WpfPropertyGrid pg = source as WpfPropertyGrid; pg.CoerceValue(SelectedObjectsProperty); if (e.NewValue == null) { pg.OnSelectionChangedMethod.Invoke(pg.Designer.PropertyInspectorView, new object[] { null }); pg.SelectionTypeLabel.Text = string.Empty; } else { var context = new EditingContext(); var mtm = new ModelTreeManager(context); mtm.Load(e.NewValue); Selection selection = Selection.Select(context, mtm.Root); pg.OnSelectionChangedMethod.Invoke(pg.Designer.PropertyInspectorView, new object[] { selection }); pg.SelectionTypeLabel.Text = e.NewValue.GetType().Name; } pg.ChangeHelpText(string.Empty, string.Empty); }
private static void ToolbarVisiblePropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { WpfPropertyGrid pg = source as WpfPropertyGrid; pg.PropertyToolBar.Visibility = e.NewValue.Equals(true) ? Visibility.Visible : Visibility.Collapsed; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 6 "..\..\MainWindow.xaml" ((FlowDesigner.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: #line 9 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.proj_menu_delete); #line default #line hidden return; case 3: #line 12 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.param_menu_delete); #line default #line hidden return; case 4: #line 15 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.item_menu_delete); #line default #line hidden return; case 5: #line 18 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.proj_prop_show); #line default #line hidden return; case 6: this.new_proj = ((System.Windows.Controls.Button)(target)); #line 24 "..\..\MainWindow.xaml" this.new_proj.Click += new System.Windows.RoutedEventHandler(this.new_proj_Click); #line default #line hidden return; case 7: this.AddFlow = ((System.Windows.Controls.Button)(target)); #line 31 "..\..\MainWindow.xaml" this.AddFlow.Click += new System.Windows.RoutedEventHandler(this.AddFlow_Click); #line default #line hidden return; case 8: this.Save_button = ((System.Windows.Controls.Button)(target)); #line 38 "..\..\MainWindow.xaml" this.Save_button.Click += new System.Windows.RoutedEventHandler(this.Button_Click_1); #line default #line hidden return; case 9: #line 45 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_2); #line default #line hidden return; case 10: this.AddNEvent = ((System.Windows.Controls.CheckBox)(target)); #line 55 "..\..\MainWindow.xaml" this.AddNEvent.Click += new System.Windows.RoutedEventHandler(this.AddNEvent_Click); #line default #line hidden return; case 11: this.AddSEvent = ((System.Windows.Controls.CheckBox)(target)); #line 62 "..\..\MainWindow.xaml" this.AddSEvent.Click += new System.Windows.RoutedEventHandler(this.AddNEvent_Click); #line default #line hidden return; case 12: this.AddLEvent = ((System.Windows.Controls.CheckBox)(target)); #line 69 "..\..\MainWindow.xaml" this.AddLEvent.Click += new System.Windows.RoutedEventHandler(this.AddNEvent_Click); #line default #line hidden return; case 13: this.AddNewParam = ((System.Windows.Controls.CheckBox)(target)); #line 76 "..\..\MainWindow.xaml" this.AddNewParam.Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; case 14: this.AddNewFlow = ((System.Windows.Controls.CheckBox)(target)); #line 85 "..\..\MainWindow.xaml" this.AddNewFlow.Click += new System.Windows.RoutedEventHandler(this.AddNewFlow_Click); #line default #line hidden return; case 15: this.Complie = ((System.Windows.Controls.Button)(target)); #line 94 "..\..\MainWindow.xaml" this.Complie.Click += new System.Windows.RoutedEventHandler(this.Comple_Click); #line default #line hidden return; case 16: this.ToDb = ((System.Windows.Controls.Button)(target)); #line 101 "..\..\MainWindow.xaml" this.ToDb.Click += new System.Windows.RoutedEventHandler(this.Refresh_toDB); #line default #line hidden return; case 17: this.main_treeView = ((System.Windows.Controls.TreeView)(target)); #line 116 "..\..\MainWindow.xaml" this.main_treeView.SelectedItemChanged += new System.Windows.RoutedPropertyChangedEventHandler <object>(this.main_treeView_SelectedItemChanged); #line default #line hidden return; case 18: this.mainTab = ((System.Windows.Controls.TabControl)(target)); #line 119 "..\..\MainWindow.xaml" this.mainTab.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.mainTab_SelectionChanged); #line default #line hidden return; case 19: this.property = ((System.Windows.Controls.WpfPropertyGrid)(target)); return; } this._contentLoaded = true; }