MetroWindow Class
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 "/mahapps.com/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 Field Type Constant Value Summary
FlyoutOverlayBrushProperty DependencyProperty
static
FlyoutsProperty DependencyProperty
static
FlyoutsStatusChangedEvent RoutedEvent
static
GlowBrushProperty DependencyProperty
static
IconBitmapScalingModeProperty DependencyProperty
static
IconEdgeModeProperty DependencyProperty
static
IconOverlayBehaviorProperty DependencyProperty
static
IconScalingModeProperty DependencyProperty
static
IconTemplateProperty DependencyProperty
static
IgnoreTaskbarOnMaximizeProperty DependencyProperty
Identifies the IgnoreTaskbarOnMaximize dependency property.
static
IsAnyDialogOpenProperty DependencyProperty
Identifies the IsAnyDialogOpen dependency property.
static
IsCloseButtonEnabledProperty DependencyProperty
static
IsCloseButtonEnabledWithDialogProperty DependencyProperty
Identifies the IsCloseButtonEnabledWithDialog dependency property.
static
IsMaxRestoreButtonEnabledProperty DependencyProperty
static
IsMinButtonEnabledProperty DependencyProperty
static
IsWindowDraggableProperty DependencyProperty
static
KeepBorderOnMaximizeProperty DependencyProperty
DependencyProperty for KeepBorderOnMaximize.
static
LeftWindowCommandsOverlayBehaviorProperty DependencyProperty
static
LeftWindowCommandsProperty DependencyProperty
static
MetroDialogOptionsProperty DependencyProperty
static
NonActiveBorderBrushProperty DependencyProperty
static
NonActiveGlowBrushProperty DependencyProperty
static
NonActiveWindowTitleBrushProperty DependencyProperty
static
OverlayBrushProperty DependencyProperty
static
OverlayFadeInProperty DependencyProperty
Identifies the OverlayFadeIn dependency property.
static
OverlayFadeOutProperty DependencyProperty
Identifies the OverlayFadeOut dependency property.
static
OverlayOpacityProperty DependencyProperty
static
OverrideDefaultWindowCommandsBrushProperty DependencyProperty
static
ResizeBorderThicknessProperty DependencyProperty
DependencyProperty for ResizeBorderThickness.
static
RightWindowCommandsOverlayBehaviorProperty DependencyProperty
static
RightWindowCommandsProperty DependencyProperty
static
SaveWindowPositionProperty DependencyProperty
static
ShowCloseButtonProperty DependencyProperty
static
ShowDialogsOverTitleBarProperty DependencyProperty
static
ShowIconOnTitleBarProperty DependencyProperty
static
ShowMaxRestoreButtonProperty DependencyProperty
static
ShowMinButtonProperty DependencyProperty
static
ShowSystemMenuOnRightClickProperty DependencyProperty
static
ShowSystemMenuProperty DependencyProperty
static
ShowTitleBarProperty DependencyProperty
static
TitleAlignmentProperty DependencyProperty
static
TitleBarHeightProperty DependencyProperty
static
TitleCharacterCasingProperty DependencyProperty
static
TitleForegroundProperty DependencyProperty
static
TitleTemplateProperty DependencyProperty
static
TryToBeFlickerFreeProperty DependencyProperty
DependencyProperty for TryToBeFlickerFree.
static
UseNoneWindowStyleProperty DependencyProperty
static
WindowButtonCommandsOverlayBehaviorProperty DependencyProperty
static
WindowButtonCommandsProperty DependencyProperty
static
WindowPlacementSettingsProperty DependencyProperty
static
WindowTitleBrushProperty DependencyProperty
static
WindowTransitionCompletedEvent RoutedEvent
static
WindowTransitionsEnabledProperty DependencyProperty
static

Properties

Name Property Type Summary
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 Return 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
OnCreateAutomationPeer() AutomationPeer
Creates AutomationPeer (UIElement.OnCreateAutomationPeer)
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.