Skip to content
Jan Karger edited this page Jul 20, 2017 · 6 revisions

Properties

Property Description
AllowFocusElement (bool) Indicates whether if the child window should focus an element. (property default: true)
AllowMove (bool) Indicates whether the child window can be moved with the TitleBar inside the overlay container. (property default: false)
AutoCloseInterval (long) Gets or sets the time in milliseconds when the child window should auto close. (property default: 5000L)
BorderBrush (Brush) Defines the border brush for the child window. (property default: null)
BorderThickness Defines the border thickness for the child window.
ChildWindowHeight (double) Defines the height for the child window. (property default: Double.NaN)
ChildWindowResult (object) Gets the child window result when the dialog was closed.
ChildWindowWidth (double) Defines the width for the child window. (property default: Double.NaN)
CloseButtonCommand (ICommand) Defines a command for the close button. This command will only be executed if the Close method was called. (property default: null)
CloseButtonCommandParameter (object) Defines a (bindable) parameter for the close button command. (property default: null)
CloseButtonStyle (Style) Defines the style for the close button. (property default: null, style default: MetroWindowButtonStyle from MahApps.Metro)
CloseByEscape (bool) Indicates whether the child window can be closed by the Escape key. (property default: true)
CloseOnOverlay (bool) Indicates whether the child window can be closed by clicking on the overlay. (property default: false)
EnableDropShadow (bool) Indicates whether a shadow (glow) is shown or not around the child window. (property default: true)
FocusedElement (FrameworkElement) Defines which element should be focused after the child window opens (if no element is defined, the first focusable element will be focused).
GlowBrush (SolidColorBrush) Defines the shadow (glow) for the child window. (property default: Black)
HorizontalContentAlignment Defines the horizontal position of the child window. (property default: Center)
Icon (object) Defines an icon for the title bar.
IconTemplate (DataTemplate) Defines a template for the Icon. (property default: null)
IsAutoCloseEnabled (bool) Indicates whether the child window should auto close after the value of AutoCloseInterval has passed. (property default: false)
IsModal (bool) Indicates wheter the child window is modal or not. If a OverlayBrush is set then it handles the mouse click event (property default: true))
IsOpen (bool) Bindable property to show or close the child window.
IsWindowHostActive (bool) Indicates whether the host Window is active or not. (property default: true)
NonActiveBorderBrush (Brush) Defines the border brush for non-active status. (property default: Gray, style default: NonActiveBorderColorBrush from MahApps.Metro)
NonActiveGlowBrush (SolidColorBrush) Defines the shadow (glow) for non-active status. (property default: Gray, style default: NonActiveBorderColorBrush from MahApps.Metro)
OverlayBrush (Brush) The brush for the overlay. (property default: Transparent, style default: GrayBrush3 from MahApps.Metro)
ShowCloseButton (bool) Show or hide a close button on the title bar. (property default: false)
ShowTitleBar (bool) Show or hides the title bar. (property default: true)
Title (string) The title for the child window.
TitleBarBackground (Brush) The title bar background. (property default: Transparent, style default: WindowTitleColorBrush from MahApps.Metro)
TitleBarHeight (int) Sets the title bar height. (property default: 30)
TitleBarNonActiveBackground (Brush) Defines the title bar background for non-active status. (property default: Gray, style default: NonActiveWindowTitleColorBrush from MahApps.Metro)
TitleCharacterCasing (CharacterCasing) Gets or sets the character casing of the title. (property default: Normal)
TitleFontFamily (FontFamily) The font family for the title. (property default: SystemFonts.CaptionFontFamily, style default: HeaderFontFamily from MahApps.Metro)
TitleFontSize (double) The font size for the title. (property default: SystemFonts.CaptionFontSize, style default: WindowTitleFontSize from MahApps.Metro)
TitleForeground (Brush) The title foreground. (property default: Black, style default: IdealForegroundColorBrush from MahApps.Metro)
TitleHorizontalAlignment (HorizontalAlignment) Gets or sets the title horizontal alignment. (property default: Stretch)
TitleTemplate (DataTemplate) Gets or sets the title content template to show a custom title. (property default: null, style default: template with TextBlock and Margin="4" and TextTrimming="CharacterEllipsis" )
TitleVerticalAlignment (VerticalAlignment) Gets or sets the title vertical alignment. (property default: Center)
VerticalContentAlignment Defines the vertical position of the child window. (property default: Center)

Closing

The ChildWindow has this method to close it explicit.

public bool Close(object childWindowResult = null)

It will raise the Closing event and execute the CloseButtonCommand. After successfully closing the ClosingFinished event will be raised.

You can pass a child window result if you use the ShowChildWindowAsync method from the ChildWindowManager.

Events

Event Description
IsOpenChanged (RoutedEventHandler) An event that is raised when IsOpen property changes.
Closing (EventHandler) An event that is raised when the ChildWindow is closing.
ClosingFinished (RoutedEventHandler) An event that is raised when the closing animation has finished.