private void ShowOrHideFavoriteListClick(object obj) { if (SelectedTabItem != null) { SelectedTabItem.ShowOrHideFavoriteListClick(obj); } }
private void Save() { if (SelectedTabItem != null) { SelectedTabItem.Save(); } }
/// <summary> /// Controls the s. /// </summary> /// <param name="obj">The object.</param> private void CtrlS(object obj) { //if tab exist, save it if (!SelectedTabItem.Equals(null)) { SaveTab(SelectedTabItem); } }
public static void Launch(SelectedTabItem delegateMethod) { if (tabWin != null) { return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); tabWin = new TabWindow() { selectedDelegate = delegateMethod }; tabWin.Show(); }
/// <summary> /// Implements custom placement for ribbon popup /// </summary> /// <param name="popupsize"></param> /// <param name="targetsize"></param> /// <param name="offset"></param> /// <returns></returns> CustomPopupPlacement[] CustomPopupPlacementMethod(Size popupsize, Size targetsize, Point offset) { if ((popup != null) && (SelectedTabItem != null)) { // Get current workarea Point tabItemPos = SelectedTabItem.PointToScreen(new Point(0, 0)); NativeMethods.Rect tabItemRect = new NativeMethods.Rect(); tabItemRect.Left = (int)tabItemPos.X; tabItemRect.Top = (int)tabItemPos.Y; tabItemRect.Right = (int)tabItemPos.X + (int)SelectedTabItem.ActualWidth; tabItemRect.Bottom = (int)tabItemPos.Y + (int)SelectedTabItem.ActualHeight; uint MONITOR_DEFAULTTONEAREST = 0x00000002; System.IntPtr monitor = NativeMethods.MonitorFromRect(ref tabItemRect, MONITOR_DEFAULTTONEAREST); if (monitor != System.IntPtr.Zero) { NativeMethods.MonitorInfo monitorInfo = new NativeMethods.MonitorInfo(); monitorInfo.Size = Marshal.SizeOf(monitorInfo); NativeMethods.GetMonitorInfo(monitor, monitorInfo); Point startPoint = PointToScreen(new Point(0, 0)); if (FlowDirection == FlowDirection.RightToLeft) { startPoint.X -= ActualWidth; } double inWindowRibbonWidth = monitorInfo.Work.Right - Math.Max(monitorInfo.Work.Left, startPoint.X); double actualWidth = ActualWidth; if (startPoint.X < monitorInfo.Work.Left) { actualWidth -= monitorInfo.Work.Left - startPoint.X; startPoint.X = monitorInfo.Work.Left; } // Set width popup.Width = Math.Min(actualWidth, inWindowRibbonWidth); return(new CustomPopupPlacement[] { new CustomPopupPlacement(new Point(startPoint.X - tabItemPos.X, SelectedTabItem.ActualHeight - (popup.Child as FrameworkElement).Margin.Top), PopupPrimaryAxis.None), new CustomPopupPlacement(new Point(startPoint.X - tabItemPos.X, -(SelectedContent as RibbonGroupsContainer).ActualHeight - (popup.Child as FrameworkElement).Margin.Bottom), PopupPrimaryAxis.None), }); } } return(null); }
private void Save() { SelectedTabItem.Save(); }