svbnet
svbnet

Reputation: 1100

WPF Borderless window buttons

I have a WPF window which is without the window chrome, so I have implemented custom window controls, like here (I'm going to style them later):

The XAML for this is:

                <StackPanel Orientation="Horizontal" Grid.Column="2" FlowDirection="RightToLeft">
                    <Button FontFamily="Marlett" FontSize="16" VerticalAlignment="Top" Foreground="White" Background="Black" Width="40">r</Button>
                    <Button FontFamily="Marlett" FontSize="16" VerticalAlignment="Top" Foreground="White" Background="Black" Width="30">1</Button>
                    <Button FontFamily="Marlett" FontSize="16" VerticalAlignment="Top" Foreground="White" Background="Black" Width="30">0</Button>
                </StackPanel>

However, I want the icons that are used in the native Windows chrome. Here's an example in Spotify:

As you can see, they look a lot like the Windows buttons, and they fit right in with the background gradient.

Is there a way this can be implemented in WPF, or is there a place I can obtain the Windows window options images/glyphs?

Upvotes: 1

Views: 1033

Answers (3)

Sheridan
Sheridan

Reputation: 69987

You can find the XAML for those button icons by looking into the XAML file for the default Aero WPF theme. You can download the XAML for all of the themes... there is a nice list of them found in this post.

Look in the ControlTemplate for the x:Type Window to find that XAML.

Upvotes: 1

Jon B
Jon B

Reputation: 885

Set the backgrounds of your buttons to be transparent, and the gradient of the background will shine straight through. Don't forget to set IsHitTestVisible to True, though. Transparent buttons can't be pressed unless IsHitTestVisible is true;

Upvotes: 0

Onur
Onur

Reputation: 599

You can get user's color preferences with SystemColors.

Upvotes: 0

Related Questions