Edit

Share via


Window

The Window control represents a window in Windows Presentation Foundation (WPF) applications. It provides the foundation for creating standalone desktop applications with a title bar, borders, and standard window controls like minimize, maximize, and close buttons. Windows can host any WPF content and support features like dialog boxes, modeless windows, and application main windows.

Styles and templates

You can customize the appearance of the Window control by modifying its default ControlTemplate. For more information about customizing templates, see Create a template for a control.

Content property

The Window control uses the Content property to define the main content displayed within the window.

Parts

The Window control doesn't define any named template parts.

Visual states

The Window control doesn't define any visual states.

ControlTemplate

The following XAML shows the default template for the Window control:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style x:Key="WindowStyle1" TargetType="{x:Type Window}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Window}">
                    <ContentPresenter/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>

See also