/// <summary> /// /// </summary> public void Dispose() { this.Loaded -= pgec_Loaded; if (0 == gControlType.Children.Count) { return; } UIElement ui = gControlType.Children[0]; if (ui is DatePicker) { DatePicker dp = ui as DatePicker; dp.SelectedDateChanged -= dp_SelectedDateChanged; dp.LostFocus -= dp_LostFocus; } else if (ui is TextBox) { TextBox tb = ui as TextBox; tb.TextChanged -= tb_TextChanged; tb.LostFocus -= tb_LostFocus; } else if (ui is PropertyGridDialogCtrl) { PropertyGridDialogCtrl dc = ui as PropertyGridDialogCtrl; dc.Dispose(); } else if (ui is ComboBox) { ComboBox cb = ui as ComboBox; cb.SelectionChanged -= cb_SelectionChanged; cb.LostFocus -= cb_LostFocus; } }
FrameworkElement _ShowDialog(Type tt) { object obj = Wrapper.CreateInstance(AssemblyQualifiedName); if (null == obj) { return(new TextBox()); } var dialog = new PropertyGridDialogCtrl(); dialog.Close += dialog_Close; dialog.IDesignFramework = IDesignFramework; dialog.UIElementProperty = obj as FrameworkElement; dialog.AssemblyQualifiedName = AssemblyQualifiedName; dialog.CurrentSelectedControlName = this.CurrentSelectedControlName; if (null != this.EvaluationContent && !this.EvaluationContent.Value.IsNullOrEmpty()) { dialog.EvaluationContent = this.EvaluationContent; } else { this.EvaluationContent = dialog.EvaluationContent; } return(dialog); }
FrameworkElement _PropertyGrid(Type tt) { var obj = Activator.CreateInstance(tt); if (obj is DateTime) { return(_DatePickerCtrl()); } else if (obj is FrameworkElement) { var ui = obj as FrameworkElement; var dialog = new PropertyGridDialogCtrl(); dialog.Close += dialog_Close; dialog.UIElementProperty = ui; dialog.AssemblyQualifiedName = AssemblyQualifiedName; return(dialog); } return(_TextBoxCtrl()); }