public static void ShowOperationControl(DockControl.IDockAbleControl ctrl) { if (ctrl.IsShowing) { // 已经显示的放到前台 var parentTabItem = EditorCommon.Program.GetParent((FrameworkElement)(ctrl), typeof(TabItem)) as TabItem; var parentTabControl = EditorCommon.Program.GetParent((FrameworkElement)(ctrl), typeof(TabControl)) as TabControl; if (parentTabControl != null && parentTabItem != null) { parentTabControl.SelectedItem = parentTabItem; } // 将包含该控件的窗体显示到最前 var parentWin = EditorCommon.Program.GetParent((FrameworkElement)(ctrl), typeof(Window)) as Window; ResourceLibrary.Win32.BringWindowToTop(new System.Windows.Interop.WindowInteropHelper(parentWin).Handle); } else { // 判断是不是已经加载了 var dockWin = new DockControl.DockAbleWindow(); dockWin.SetContent(ctrl); dockWin.Show(); ctrl.IsShowing = true; } }
public static object ShowPropertyGridInWindows(object insObj, object inspector = null) { var mLastPropertyGrid = inspector as WPG.PropertyGrid; if (mLastPropertyGrid == null) { var win = new DockControl.DockAbleWindow(); mLastPropertyGrid = new WPG.PropertyGrid(); mLastPropertyGrid.Instance = insObj; win.MainGrid.Children.Add(mLastPropertyGrid); win.Show(); return(mLastPropertyGrid); } else { mLastPropertyGrid.Instance = insObj; return(mLastPropertyGrid); } }