我正在使用
当我设置任何其他背景时,
有没有办法显示它们或完全禁用它们?
我可以将
我的样式如下:
WindowChrome
创建自定义的WPF窗口。我已经定义了自己的样式,但标题栏出现了问题。如果我将模板中主要Grid
的Background
设置为透明,则整个窗口使用系统强调颜色,且最大化/最小化/关闭
按钮可见。当我设置任何其他背景时,
最大化/最小化/关闭
按钮会被覆盖。我本以为只需要创建我的按钮,但是这些按钮仍然是可点击的。有没有办法显示它们或完全禁用它们?
我可以将
CaptionHeight
设置为0并创建自己的标题栏,但我不想重新实现拖动和其他默认功能。我的样式如下:
<Window.Style>
<Style TargetType="{x:Type Window}">
<Setter Property="shell:WindowChrome.WindowChrome">
<Setter.Value>
<shell:WindowChrome GlassFrameThickness="-1"
ResizeBorderThickness="4"
CaptionHeight="36"/>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:ConfigurationWindow}" >
<Grid>
<Rectangle Fill="Blue" VerticalAlignment="Top" Width="{TemplateBinding Width}"
Height="35" ></Rectangle>
<!-- This is the ContentPresenter that displays the window content. -->
<Border Margin="0,40,0,5" >
<ContentPresenter Content="{TemplateBinding Content}"/>
</Border>
<!--This is the transparent white rectangle that goes behind the window content.-->
<Border Margin="1,40,1,5" BorderBrush="Gray" BorderThickness="0,1,0,1"
Grid.ZIndex="-1">
<Rectangle Fill="White" Opacity="0.5" />
</Border>
<!-- Window Title -->
<TextBlock VerticalAlignment="Top" TextAlignment="Center"
Padding="0,3,0,8"
Text="{Binding RelativeSource=
{RelativeSource TemplatedParent}, Path=Title}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Style>