Skip to content

[doc bug]: Incomplete template for Window #1997

Closed
@tonyhallett

Description

@tonyhallett

Type of issue

Other (describe below)

Description

Edit by adegeo to convert the issue to the feedback link on the page

The Trigger below refers to a non existent static resource.

<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="Foreground"
                Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
        <Setter Property="Background"
                Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Window}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <AdornerDecorator>
                            <ContentPresenter/>
                        </AdornerDecorator>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Window.ResizeMode"
                     Value="CanResizeWithGrip">
                <Setter Property="Template"
                        Value="{StaticResource WindowTemplateKey}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>

Taken from aero

  <ControlTemplate x:Key="Ǡ" TargetType="{x:Type Window}">
    <Border Background="{TemplateBinding Control.Background}"
            BorderBrush="{TemplateBinding Control.BorderBrush}"
            BorderThickness="{TemplateBinding Control.BorderThickness}">
      <Grid>
        <AdornerDecorator>
          <ContentPresenter/>
        </AdornerDecorator>
        <ResizeGrip x:Name="WindowResizeGrip" HorizontalAlignment="Right" VerticalAlignment="Bottom"
                    Visibility="Collapsed" IsTabStop="false"/>
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Window.ResizeMode" Value="CanResizeWithGrip"/>
          <Condition Property="Window.WindowState" Value="Normal"/>
        </MultiTrigger.Conditions>
        <Setter TargetName="WindowResizeGrip" Property="UIElement.Visibility" Value="Visible"/>
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style TargetType="{x:Type Window}">
    <Setter Property="Control.Foreground"
            Value="{DynamicResource {x:Static JetSystemColors.WindowTextBrushKey}}"/>
    <Setter Property="Control.Background" Value="{DynamicResource {x:Static JetSystemColors.WindowBrushKey}}"/>
    <Setter Property="Control.Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Window}">
          <Border Background="{TemplateBinding Control.Background}"
                  BorderBrush="{TemplateBinding Control.BorderBrush}"
                  BorderThickness="{TemplateBinding Control.BorderThickness}">
            <AdornerDecorator>
              <ContentPresenter/>
            </AdornerDecorator>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <Trigger Property="Window.ResizeMode" Value="CanResizeWithGrip">
        <Setter Property="Control.Template" Value="{StaticResource Ǡ}"/>
      </Trigger>
    </Style.Triggers>
  </Style>

Page URL

https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/window-styles-and-templates?view=netframeworkdesktop-4.8

Content source URL

https://github.com/dotnet/docs-desktop/blob/main/dotnet-desktop-guide/framework/wpf/controls/window-styles-and-templates.md

Document Version Independent Id

c1f96787-03b0-7740-51fb-9722a9609198

Article author

@adegeo

Metadata

  • ID: 844e0881-ff9c-8374-6080-3c24ae15cb48
  • Service: dotnet-framework
  • Sub-service: wpf

Related Issues


Associated WorkItem - 371157

Metadata

Metadata

Assignees

Labels

📌 seQUESTeredLabel to indicate an item has been imported.Pri1High priority, do before Pri2 and Pri3doc-bugProblem with the content; needs to be fixed [org][type][category]dotnet-framework/svcin-prokr-qualitywpf/subsvc

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions