0

Is there any way to change the Minimize button, Maximize button, WPF window frame/border ect. using styles in the xaml?

H.B.
  • 166,899
  • 29
  • 327
  • 400
Lucas Stanesa
  • 71
  • 2
  • 7

2 Answers2

1

These buttons are part of the Window Chrome, and therefore are supposed to be left for the user to decide on how they look (Windows has options for changing the color of the chrome). So if you want to take control of the Chrome, it is not as simple as a window style.

You can use the WindowStyle property to get rid of them, or make the window a Dialog-type window, but for more control, you'll need to get into creating custom chrome for your window.

If you want to go down this path, it is definitely possible, but you'll need to look at information about creating a custom chrome for your window. Here are a couple resources, but do your research and see which of these, or what other resources best meet your needs:

  1. Code Project Library
  2. Stack Overflow Answer w/ Links
  3. MSDN Blog
Community
  • 1
  • 1
Brian S
  • 5,675
  • 1
  • 22
  • 22
1

You can remove the default Windows chrome with WindowStyle="None" and ResizeMode="NoResize" and then create whatever borders/buttons you like. E.g.

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        WindowStyle="None"
        ResizeMode="NoResize"
        BorderBrush="Blue"
        BorderThickness="5">
    <StackPanel Orientation="Horizontal" 
                VerticalAlignment="Top" 
                HorizontalAlignment="Right"
                Height="20" >
        <Button Content="Minimize" />
        <Button Content="Restore" />
        <Button Content="Close" />
    </StackPanel>
</Window>
Kevin Aenmey
  • 13,259
  • 5
  • 46
  • 45