Exemplo n.º 1
0
        public static void SetToDialogStyle(this Window window, Window parentWindow = null, bool closeable = true, bool centerToParent = true, bool setTransient = true)
        {
            if (parentWindow == null)
            {
                parentWindow = ApplicationCurrent.MainWindow;
            }
            if (centerToParent)
            {
                window.CenterToParentWindow(parentWindow);
            }
            if (setTransient)
            {
                window.TransientFor = parentWindow;
            }
            window.Deletable = closeable;
            if (!Platform.IsMac)
            {
                return;
            }
            NSWindowStyle nsWindowStyle = NSWindowStyle.Titled;

            if (closeable)
            {
                nsWindowStyle |= NSWindowStyle.Closable;
            }
            if (window.GdkWindow == null)
            {
                window.Show();
            }
            SetNSWindowStyle.GetNSWindow(window.GdkWindow).StyleMask = nsWindowStyle;
        }