ControlTemplate in WPF —— Window

来源:互联网 发布:网络儿童英语 编辑:程序博客网 时间:2024/06/02 05:05
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">  <ResourceDictionary.MergedDictionaries>    <ResourceDictionary Source="Shared.xaml" />    <ResourceDictionary Source="ResizeGrip.xaml" />  </ResourceDictionary.MergedDictionaries><!--<SnippetWindow>-->  <Style x:Key="{x:Type Window}"         TargetType="{x:Type Window}">    <Setter Property="SnapsToDevicePixels"            Value="true" />    <Setter Property="Template">      <Setter.Value>        <ControlTemplate TargetType="{x:Type Window}">          <Grid>            <Grid.Background>              <SolidColorBrush Color="{DynamicResource WindowColor}"/>            </Grid.Background>            <AdornerDecorator>              <ContentPresenter />            </AdornerDecorator>            <ResizeGrip x:Name="WindowResizeGrip"                        HorizontalAlignment="Right"                        VerticalAlignment="Bottom"                        Visibility="Collapsed"                        IsTabStop="false" />          </Grid>          <ControlTemplate.Triggers>            <Trigger Property="ResizeMode"                     Value="CanResizeWithGrip">              <Setter TargetName="WindowResizeGrip"                      Property="Visibility"                      Value="Visible" />            </Trigger>          </ControlTemplate.Triggers>        </ControlTemplate>      </Setter.Value>    </Setter>  </Style><!--</SnippetWindow>--></ResourceDictionary>

原创粉丝点击