Exemplo n.º 1
0
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            VisualStateManager.GoToState(this, "AfterLoaded", true);

            if (!ShowTitleBar)
            {
                //Disables the system menu for reasons other than clicking an invisible titlebar.
                IntPtr handle = new WindowInteropHelper(this).Handle;
                UnsafeNativeMethods.SetWindowLong(handle, UnsafeNativeMethods.GWL_STYLE, UnsafeNativeMethods.GetWindowLong(handle, UnsafeNativeMethods.GWL_STYLE) & ~UnsafeNativeMethods.WS_SYSMENU);
            }

            // if UseNoneWindowStyle = true no title bar, window commands or min, max, close buttons should be shown
            if (UseNoneWindowStyle)
            {
                WindowCommandsPresenter.Visibility = Visibility.Collapsed;
                ShowMinButton        = false;
                ShowMaxRestoreButton = false;
                ShowCloseButton      = false;
            }

            if (this.Flyouts == null)
            {
                this.Flyouts = new FlyoutsControl();
            }

            if (MessageDialogOptions == null)
            {
                MessageDialogOptions = new MessageDialogSettings();
            }
        }
Exemplo n.º 2
0
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            VisualStateManager.GoToState(this, "AfterLoaded", true);

            if (!ShowTitleBar)
            {
                //Disables the system menu for reasons other than clicking an invisible titlebar.
                IntPtr handle = new WindowInteropHelper(this).Handle;
                UnsafeNativeMethods.SetWindowLong(handle, UnsafeNativeMethods.GWL_STYLE, UnsafeNativeMethods.GetWindowLong(handle, UnsafeNativeMethods.GWL_STYLE) & ~UnsafeNativeMethods.WS_SYSMENU);
            }

            if (this.Flyouts == null)
            {
                this.Flyouts = new FlyoutsControl();
            }

            if (MessageDialogOptions == null)
            {
                MessageDialogOptions = new MessageDialogSettings();
            }
        }