A simple child window for MahApps.Metro. Yes, this means you need MahApps.Metro
to use this control.
The dll contains the ChildWindow
and a helper class ChildWindowManager
.
MahApps.Metro.SimpleChildWindow can be installed via NuGet
.
AllowMove
(bool
defaultfalse
) : The child window can be moved by the title barIsModal
(bool
defaulttrue
) : The overlay takes the mouse events if an overlay brush exists (by default it is black with an opacity)OverlayBrush
(Brush
defaultTransparent
) : The brush for the overlay container. The theme defines this to a black solid brush with an opacityCloseOnOverlay
(bool
defaultfalse
) : If this set totrue
the child window can be closed by thisShowTitleBar
(bool
defaulttrue
) : Show/hides the title barTitleBarHeight
(int
default30
) : Sets the title bar heightTitleBarBackground
(Brush
defaultWindowTitleColorBrush
from MahApps.Metro) : The title bar backgroundTitleForeground
(Brush
defaultIdealForegroundColorBrush
from MahApps.Metro) : The title foregroundTitle
(string
) : The title for the child windowTitleFontSize
(double
defaultWindowTitleFontSize
from MahApps.Metro)TitleFontFamily
(FontFamily
defaultHeaderFontFamily
from MahApps.Metro)Icon
(object
) : Defines an icon for the title barIconTemplate
(DataTemplate
) : Defines a template for theIcon
or something elseShowCloseButton
(bool
defaultfalse
) : Show a close button on the title barCloseButtonStyle
(Style
defaultMetroWindowButtonStyle
from MahApps.Metro) : Defines the style for the close buttonCloseButtonCommand
(ICommand
) : Defines a command for the close buttonCloseButtonCommandParameter
(object
) : Defines a (bindable) parameter for the close button commandIsOpen
(bool
) : Show or closes the child windowChildWindowWidth
(double
) : Defines the width for the child windowChildWindowHeight
(double
) : Defines the height for the child windowEnableDropShadow
(bool
defaulttrue
) : Shows a shadow (glow) around the child windowGlowBrush
(SolidColorBrush
defaultBlack
) : Defines the glow (shadow) for the child windowBorderBrush
: Defines the brush for the child window borderBorderThickness
: Defines the border thickness for the child windowFocusedElement
(FrameworkElement
) : Which element should be focused after open the child window (if no element is defined, the first element will be focused)AllowFocusElement
(bool
defaulttrue
) : Defines if the child window should focus an elementVerticalContentAlignment
: Defines the vertical position of the child windowHorizontalContentAlignment
: Defines the horizontal position of the child window
Show a child window with this method.
public static Task ShowChildWindowAsync(this MetroWindow window,
ChildWindow dialog,
OverlayFillBehavior overlayFillBehavior = OverlayFillBehavior.WindowContent)
OverlayFillBehavior
: An enumeration to control the fill behavior of the behavior (full window or only the content)
Directly in XAML
<simpleChildWindow:ChildWindow
IsOpen="{Binding IsChildWindowOpenOrNotProperty}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Padding="15"
ChildWindowImage="Error"
Title="TestChild 1">
<Grid>
</Grid>
</simpleChildWindow:ChildWindow>
Or with the ChildWindowManager
private async void OpenAChildWindow_OnButtonClick(object sender, RoutedEventArgs e)
{
// opens a cool child window
await this.ShowChildWindowAsync(new CoolChildWindow() { IsModal = false });
}
The MIT License (MIT)
Copyright (c) 2014 Jan Karger
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.