文档:仅限 Windows Aero DwmWin XAML 的简单边框

来自 WinStory Wiki
跳转到导航 跳转到搜索
<?Mapping XmlNamespace="mscorlib_System" ClrNamespace="System" Assembly="mscorlib" ?>
<?Mapping XmlNamespace="windowmanager.WindowLayouts" ClrNamespace="WindowLayouts" Assembly="WindowManager" ?>
<FlowPanel xmlns="http://schemas.microsoft.com/2003/xaml/" xmlns:wl="windowmanager.WindowLayouts" xmlns:System="mscorlib_System" xmlns:def="Definition" Width="800" Height="600" Background="#80FF0000">
  <FlowPanel.Resources>
    <Style def:Name="NonClientAreaStyleNone">
      <wl:UserWindowChrome Width="*Bind(Path=Width)" Height="*Bind(Path=Height)"/>
      <Style.VisualTree>
        <Canvas ID="Region_WindowTransform">
          <Image ID="ClientArea" Source="*Bind(Path=ClientArea)"/>
        </Canvas>
      </Style.VisualTree>
    </Style>
    <Style def:Name="NonClientAreaStyleBorder">
      <wl:UserWindowChrome Background="#800000ff" Width="*Bind(Path=Width)" Height="*Bind(Path=Height)"/>
      <Style.VisualTree>
        <Canvas ID="Region_WindowTransform" Background="#800000ff">
          <Image ID="ClientArea" Source="*Bind(Path=ClientArea)"/>
          <Text TextContent="*Bind(Path=Title)"/>
        </Canvas>
      </Style.VisualTree>
    </Style>
    <Style def:Name="NonClientAreaStyleFrame">
      <wl:UserWindowChrome Background="#8000ffff" Width="*Bind(Path=Width)" Height="*Bind(Path=Height)"/>
      <Style.VisualTree>
        <DockPanel ID="Region_WindowTransform" Background="#8000ffff">
          <Canvas DockPanel.Dock="Top" ID="Region_Resize" Margin="6,6,6,0" Background="#00112233">
            <DockPanel Width="100%">
              <Canvas ID="CloseButton" Width="20" Height="20" Background="#FFFF0000" DockPanel.Dock="Right"/>
              <Canvas ID="MaximizeButton" Width="20" Height="20" Background="#FF00FF00" DockPanel.Dock="Right"/>
              <Canvas ID="MinimizeButton" Width="20" Height="20" Background="#FF0000FF" DockPanel.Dock="Right"/>
              <Text TextContent="*Bind(Path=Title)" DockPanel.Dock="Left"/>
            </DockPanel>
          </Canvas>
          <DockPanel DockPanel.Dock="Bottom" Margin="0,0,0,6">
            <Canvas DockPanel.Dock="Right" Margin="6,0,6,0">
              <Image ID="ClientArea" Source="*Bind(Path=ClientArea)"/>
            </Canvas>
          </DockPanel>
        </DockPanel>
      </Style.VisualTree>
    </Style>
    <Style def:Name="NonClientAreaStyleFrameNonAero">
      <wl:UserWindowChrome Background="#80ffff00" Width="*Bind(Path=Width)" Height="*Bind(Path=Height)"/>
      <Style.VisualTree>
        <DockPanel ID="Region_WindowTransform" Background="#80ffff00">
          <Canvas DockPanel.Dock="Top" ID="Region_Resize" Margin="6,6,6,0" Background="#00112233">
            <DockPanel Width="100%">
              <Canvas ID="CloseButton" Width="20" Height="20" Background="#FFFF0000" DockPanel.Dock="Right"/>
              <Canvas ID="MaximizeButton" Width="20" Height="20" Background="#FF00FF00" DockPanel.Dock="Right"/>
              <Canvas ID="MinimizeButton" Width="20" Height="20" Background="#FF0000FF" DockPanel.Dock="Right"/>
              <Text TextContent="*Bind(Path=Title)" DockPanel.Dock="Left"/>
            </DockPanel>
          </Canvas>
          <DockPanel DockPanel.Dock="Bottom" Margin="0,0,0,6">
            <Canvas DockPanel.Dock="Right" Margin="6,0,6,0">
              <Image ID="ClientArea" Source="*Bind(Path=ClientArea)"/>
            </Canvas>
          </DockPanel>
        </DockPanel>
      </Style.VisualTree>
    </Style>
  </FlowPanel.Resources>
</FlowPanel>