I have found that using WindowChrome on a WPF Window can make me put content wherever I want in the Window, which is a great thought. Now I can finally make the title bar have the same color as the rest of my application.
However, I still like the default minimize/maximize/close buttons that appear on a non styled Window.
Is there any way I can style my Window using WindowChrome yet still preserve the default buttons?
<Style x:Key="MainWindow" TargetType="{x:Type Window}">
<Setter Property="WindowChrome.WindowChrome">
<Setter.Value>
<WindowChrome CaptionHeight="30" ResizeBorderThickness="5" />
</Setter.Value>
</Setter>
</Style>
<Window Style="{StaticResource MainWindow}">
<Grid Background="Black">
<MyContent />
</Grid>
</Window>
This makes a big black window (great!) but without any min/max/close buttons as they are hidden behind the Grid
(not so great). The buttons are still clickable, though, so they're obviously there.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…