Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8339523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:54:22+00:00 2026-06-09T04:54:22+00:00

Looking at the various open source themes available for WPF, I’m a bit surprised

  • 0

Looking at the various open source themes available for WPF, I’m a bit surprised to see that colours aren’t mapped to system colours. So if you change your overall system configuration, these themes won’t change to suit.

Are there any themes that properly use the system colours, and if so, how do I write a button style that will leverage those colours?

To give an example, here’s the style of a button:

    <Style x:Key="specialButton" TargetType="Button">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
        <Setter Property="Background" Value="{StaticResource NormalBrush}"/>
        <Setter Property="Margin" Value="2"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border Name="border"
                    BorderThickness="1"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{StaticResource NormalBorderBrush}"
                    Padding="1,1">
                        <ContentPresenter Name="content" HorizontalAlignment="Center" VerticalAlignment="Center" RecognizesAccessKey="True"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource DarkBrush}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="border" Property="Background" Value="{StaticResource PressedBrush}"/>
                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource PressedBorderBrush}"/>
                        </Trigger>
                        <Trigger Property="IsDefaulted" Value="True">
                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource DefaultedBorderBrush}"/>
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource DefaultedBorderBrush}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="border" Property="Background" Value="{StaticResource DisabledBackgroundBrush}"/>
                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource DisabledBorderBrush}"/>
                            <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

The question is, how to specify the named static resources so that they hook into the system colours? For example, the background might look like this:

    <LinearGradientBrush x:Key="NormalBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="{DynamicResource {x:Static SystemColors.ControlLightLightColorKey}}" Offset="0.0"/>
                <GradientStop Color="{DynamicResource {x:Static SystemColors.ControlLightColorKey}}" Offset="1.0"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

However this looks nothing like a standard button. If I use XAMLPAD to examine a button, I can see the following:

     <LinearGradientBrush x:Key="NormalBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#FFF3F3F3" Offset="0.0"/>
                <GradientStop Color="#FFEBEBEB" Offset="0.5"/>
                <GradientStop Color="#FFDDDDDD" Offset="0.5"/>
                <GradientStop Color="#FFCDCDCD" Offset="1.0"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

The colours used appear to be constants, and not based on System Colours.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:54:24+00:00Added an answer on June 9, 2026 at 4:54 am

    I don’t know about third-party themes, but the system colours are available in Xaml through the SystemColors class. This class exposes the keys of resources that can be used in your xaml in one of two ways:

    <Border Background="{x:Static SystemColors.ControlDarkBrushKey}" />
    

    or:

    <Border Background="{StaticResource {x:Static SystemColors.ControlDarkBrushKey}}" />
    

    Either of the above should give you a border with a background the same as the system’s ControlDarkBrush colour. The documentation link I gave supplies the full list of available resources.

    It’s worth noting that SystemColors provides you with both a Brush for each colour available, and the colour itself – so if you want to create your own brush that fades from one system colour to another, you can create this easily.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a free open source tool-set that will compile various classic scripting
I'm looking for independent industry reports that compare and contrast the various source control
I'm looking for an open source audio conversion library that can convert audio files
I was looking at the various windows styles flags, and I noticed that a
I'm looking for the smartest/various way of handling categories in App Engine. I see
I have a number of splits open, looking at various buffers. But when I
I recently read about a new Google-code hosted (open source) project from Google that
I'm looking to compile a list of instructive open-source Android projects. My criteria for
I am working on an open source backup utility that backs up files and
I'm looking for an open source project written in Java with a relatively low

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.