MetroWindow Class

Summary

An extended, metrofied Window class.
Namespace
MahApps.Metro.Controls
Base Types
  • Window
Derived Types
graph BT Type-->Base0["Window"] Type["MetroWindow"] class Type type-node Derived0["MetroNavigationWindow"]-->Type click Derived0 "/api/MahApps.Metro.Controls/MetroNavigationWindow"

Syntax

[TemplatePart(Name = PART_Icon, Type = typeof(UIElement))]
[TemplatePart(Name = PART_TitleBar, Type = typeof(UIElement))]
[TemplatePart(Name = PART_WindowTitleBackground, Type = typeof(UIElement))]
[TemplatePart(Name = PART_WindowTitleThumb, Type = typeof(Thumb))]
[TemplatePart(Name = PART_FlyoutModalDragMoveThumb, Type = typeof(Thumb))]
[TemplatePart(Name = PART_LeftWindowCommands, Type = typeof(ContentPresenter))]
[TemplatePart(Name = PART_RightWindowCommands, Type = typeof(ContentPresenter))]
[TemplatePart(Name = PART_WindowButtonCommands, Type = typeof(ContentPresenter))]
[TemplatePart(Name = PART_OverlayBox, Type = typeof(Grid))]
[TemplatePart(Name = PART_MetroActiveDialogContainer, Type = typeof(Grid))]
[TemplatePart(Name = PART_MetroInactiveDialogsContainer, Type = typeof(Grid))]
[TemplatePart(Name = PART_FlyoutModal, Type = typeof(Rectangle))]
public class MetroWindow : Window

Attributes

Type Description
TemplatePart
TemplatePart
TemplatePart
TemplatePart
TemplatePart
TemplatePart
TemplatePart
TemplatePart
TemplatePart
TemplatePart
TemplatePart
TemplatePart

Constructors

Name Summary
MetroWindow() Initializes a new instance of the MahApps.Metro.Controls.MetroWindow class.

Events

Name Type Summary
FlyoutsStatusChanged RoutedEventHandler
WindowTransitionCompleted RoutedEventHandler

Fields

Name Constant Value Summary
FlyoutOverlayBrushProperty
static
FlyoutsProperty
static
FlyoutsStatusChangedEvent
static
GlowBrushProperty
static
IconBitmapScalingModeProperty
static
IconEdgeModeProperty
static
IconOverlayBehaviorProperty
static
IconScalingModeProperty
static
IconTemplateProperty
static
IgnoreTaskbarOnMaximizeProperty
Identifies the IgnoreTaskbarOnMaximize dependency property.
static
IsAnyDialogOpenProperty
Identifies the IsAnyDialogOpen dependency property.
static
IsAnyDialogOpenPropertyKey
static
IsCloseButtonEnabledProperty
static
IsCloseButtonEnabledWithDialogProperty
Identifies the IsCloseButtonEnabledWithDialog dependency property.
static
IsCloseButtonEnabledWithDialogPropertyKey
static
IsMaxRestoreButtonEnabledProperty
static
IsMinButtonEnabledProperty
static
IsWindowDraggableProperty
static
KeepBorderOnMaximizeProperty
DependencyProperty for KeepBorderOnMaximize.
static
LeftWindowCommandsOverlayBehaviorProperty
static
LeftWindowCommandsProperty
static
MetroDialogOptionsProperty
static
NonActiveBorderBrushProperty
static
NonActiveGlowBrushProperty
static
NonActiveWindowTitleBrushProperty
static
OverlayBrushProperty
static
OverlayFadeInProperty
Identifies the OverlayFadeIn dependency property.
static
OverlayFadeOutProperty
Identifies the OverlayFadeOut dependency property.
static
OverlayOpacityProperty
static
OverrideDefaultWindowCommandsBrushProperty
static
ResizeBorderThicknessProperty
DependencyProperty for ResizeBorderThickness.
static
RightWindowCommandsOverlayBehaviorProperty
static
RightWindowCommandsProperty
static
SaveWindowPositionProperty
static
ShowCloseButtonProperty
static
ShowDialogsOverTitleBarProperty
static
ShowIconOnTitleBarProperty
static
ShowMaxRestoreButtonProperty
static
ShowMinButtonProperty
static
ShowSystemMenuOnRightClickProperty
static
ShowSystemMenuProperty
static
ShowTitleBarProperty
static
TitleAlignmentProperty
static
TitleBarHeightProperty
static
TitleCharacterCasingProperty
static
TitleForegroundProperty
static
TitleTemplateProperty
static
TryToBeFlickerFreeProperty
DependencyProperty for TryToBeFlickerFree.
static
UseNoneWindowStyleProperty
static
WindowButtonCommandsOverlayBehaviorProperty
static
WindowButtonCommandsProperty
static
WindowPlacementSettingsProperty
static
WindowTitleBrushProperty
static
WindowTransitionCompletedEvent
static
WindowTransitionsEnabledProperty
static

Properties

Name Value Summary
CriticalHandle IntPtr
FlyoutOverlayBrush Brush
Gets or sets the brush used for the Flyouts overlay.
Flyouts FlyoutsControl
Gets/sets the FlyoutsControl that hosts the window's flyouts.
GlowBrush Brush
Gets/sets the brush used for the Window's glow.
IconBitmapScalingMode BitmapScalingMode
Gets/sets bitmap scaling mode of the titlebar icon.
IconEdgeMode EdgeMode
Gets/sets edge mode of the titlebar icon.
IconOverlayBehavior OverlayBehavior
IconScalingMode MultiFrameImageMode
Gets/sets icon scaling mode of the titlebar.
IconTemplate DataTemplate
Gets/sets the icon content template to show a custom icon.
IgnoreTaskbarOnMaximize bool
Defines if the Taskbar should be ignored when maximizing a Window. This only works with WindowStyle = None.
IsAnyDialogOpen bool
Gets whether one or more dialogs are shown.
IsCloseButtonEnabled bool
Gets/sets if the close button is enabled.
IsCloseButtonEnabledWithDialog bool
Gets or sets whether if the close button should be enabled or not if a dialog is shown.
IsMaxRestoreButtonEnabled bool
Gets/sets if the max/restore button is enabled.
IsMinButtonEnabled bool
Gets/sets if the min button is enabled.
IsWindowDraggable bool
KeepBorderOnMaximize bool
Gets/sets if the border thickness value should be kept on maximize if the MaxHeight/MaxWidth of the window is less than the monitor resolution.
LeftWindowCommands WindowCommands
Gets/sets the left window commands that hosts the user commands.
LeftWindowCommandsOverlayBehavior WindowCommandsOverlayBehavior
LogicalChildren IEnumerator
MetroDialogOptions MetroDialogSettings
NonActiveBorderBrush Brush
Gets/sets the brush used for the Window's non-active border.
NonActiveGlowBrush Brush
Gets/sets the brush used for the Window's non-active glow.
NonActiveWindowTitleBrush Brush
Gets/sets the brush used for the Window's non-active title bar.
OverlayBrush Brush
Gets/sets the brush used for the dialog overlay.
OverlayFadeIn Storyboard
Gets or sets the overlay fade in storyboard.
OverlayFadeOut Storyboard
Gets or sets the overlay fade out storyboard.
OverlayOpacity double
Gets/sets the opacity used for the dialog overlay.
OverrideDefaultWindowCommandsBrush Brush
Allows easy handling of window commands brush. Theme is also applied based on this brush.
ResizeBorderThickness Thickness
Gets or sets resize border thickness. This enables animation, styling, binding, etc...
RightWindowCommands WindowCommands
Gets/sets the right window commands that hosts the user commands.
RightWindowCommandsOverlayBehavior WindowCommandsOverlayBehavior
SaveWindowPosition bool
Gets/sets whether the window will save it's position between loads.
ShowCloseButton bool
Gets or sets whether if the close button is visible.
ShowDialogsOverTitleBar bool
Get/sets whether dialogs show over the title bar.
ShowIconOnTitleBar bool
Get/sets whether the titlebar icon is visible or not.
ShowMaxRestoreButton bool
Gets or sets whether if the maximize/restore button is visible and the maximize/restore system menu is enabled.
ShowMinButton bool
Gets or sets whether if the minimize button is visible and the minimize system menu is enabled.
ShowSystemMenu bool
Gets or sets a value that indicates whether the system menu should popup with left mouse click on the window icon.
ShowSystemMenuOnRightClick bool
Gets or sets a value that indicates whether the system menu should popup with right mouse click if the mouse position is on title bar or on the entire window if it has no title bar (and no title bar height).
ShowTitleBar bool
Gets/sets whether the TitleBar is visible or not.
TitleAlignment HorizontalAlignment
Gets/sets the title horizontal alignment.
TitleBarHeight int
Gets/sets the TitleBar's height.
TitleCharacterCasing CharacterCasing
Character casing of the title
TitleForeground Brush
Gets/sets the brush used for the titlebar's foreground.
TitleTemplate DataTemplate
Gets/sets the title content template to show a custom title.
TryToBeFlickerFree bool
Gets or sets wether the resizing of the window should be tried in a way that does not cause flicker/jitter, especially when resizing from the left side.
UseNoneWindowStyle bool
Gets/sets whether the WindowStyle is None or not.
WindowButtonCommands WindowButtonCommands
Gets/sets the window button commands that hosts the min/max/close commands.
WindowButtonCommandsOverlayBehavior OverlayBehavior
WindowPlacementSettings IWindowPlacementSettings
WindowTitleBrush Brush
Gets/sets the brush used for the Window's title bar.
WindowTransitionsEnabled bool
Gets/sets whether the window's entrance transition animation is enabled.

Methods

Name Value Summary
GetWindowPlacementSettings() IWindowPlacementSettings
Gets the window placement settings (can be overwritten).
HideOverlay() void
HideOverlayAsync() Task
Begins to hide the MetroWindow's overlay effect.
IsOverlayVisible() bool
OnApplyTemplate() void
OnClosing(CancelEventArgs) void
ResetStoredFocus() void
Clears the stored element which would get the focus after closing a dialog.
ShowOverlay() void
ShowOverlayAsync() Task
Begins to show the MetroWindow's overlay effect.
StoreFocus(IInputElement) void
Stores the given element, or the last focused element via FocusManager, for restoring the focus after closing a dialog.

Extension Methods

Name Value Summary
GetCurrentDialogAsync<TDialog>() Task<TDialog>
Gets the current shown dialog in async way.
HideMetroDialogAsync(BaseMetroDialog, MetroDialogSettings) Task
Hides a visible Metro Dialog instance.
ShowInputAsync(string, string, MetroDialogSettings) Task<string>
Creates a InputDialog inside of the current window.
ShowLoginAsync(string, string, LoginDialogSettings) Task<LoginDialogData>
Creates a LoginDialog inside of the current window.
ShowMessageAsync(string, string, MessageDialogStyle, MetroDialogSettings) Task<MessageDialogResult>
Creates a MessageDialog inside of the current window.
ShowMetroDialogAsync(BaseMetroDialog, MetroDialogSettings) Task
Adds a Metro Dialog instance to the specified window and makes it visible asynchronously. If you want to wait until the user has closed the dialog, use WaitUntilUnloadedAsync()

You have to close the resulting dialog yourself with HideMetroDialogAsync(MetroWindow, BaseMetroDialog, MetroDialogSettings).

ShowMetroDialogAsync<TDialog>(MetroDialogSettings) Task<TDialog>
Adds a Metro Dialog instance of the given type to the specified window and makes it visible asynchronously. If you want to wait until the user has closed the dialog, use WaitUntilUnloadedAsync()

You have to close the resulting dialog yourself with HideMetroDialogAsync(MetroWindow, BaseMetroDialog, MetroDialogSettings).

ShowModalInputExternal(string, string, MetroDialogSettings) string
Creates a InputDialog outside of the current window.
ShowModalLoginExternal(string, string, LoginDialogSettings) LoginDialogData
Creates a LoginDialog outside of the current window.
ShowModalMessageExternal(string, string, MessageDialogStyle, MetroDialogSettings) MessageDialogResult
Creates a MessageDialog ouside of the current window.
ShowProgressAsync(string, string, bool, MetroDialogSettings) Task<ProgressDialogController>
Creates a ProgressDialog inside of the current window.