© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
4 replies
malkav

WPF Styling of a button

I have this button Style in WPF that I am trying to make https://pastebin.com/xCTrerLg
The problem with this at the moment being that the following states:
Hover
Hover
,
Pressed
Pressed
, and
Disabled
Disabled
are not changing their colors appropriately. When I use the
Warning
Warning
class for example, I seem to get the
Primary
Primary
colors on those states, but the
Warning
Warning
color on the base button.
When I use
Secondary
Secondary
it changes everything to just the
Secondary
Secondary
color, and not the state colors I defined at the top of the file.
etc, etc.

So now I come here for help, in the hopes of seeing what I did wrong 😅

Additional resources:
ButtonHelper class: https://pastebin.com/9DZ09La9
How I implement the button in the pages:
<Page x:Class="CrystalTrack.Gui.Pages.Settings"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:CrystalTrack.Gui.Pages"
      xmlns:controls="clr-namespace:CrystalTrack.Gui.Controls"
      mc:Ignorable="d">
<!-- ... -->
<Button Grid.Column="2" Grid.Row="0"
  Style="{StaticResource InformButton}"
  controls:ButtonHelper.ColorClass="Warning"
  Click="ApiKeyButton_OnClick">
  Text here
</Button>
<!-- ... -->
<Page x:Class="CrystalTrack.Gui.Pages.Settings"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:CrystalTrack.Gui.Pages"
      xmlns:controls="clr-namespace:CrystalTrack.Gui.Controls"
      mc:Ignorable="d">
<!-- ... -->
<Button Grid.Column="2" Grid.Row="0"
  Style="{StaticResource InformButton}"
  controls:ButtonHelper.ColorClass="Warning"
  Click="ApiKeyButton_OnClick">
  Text here
</Button>
<!-- ... -->
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

WPF Submenu Styling
C#CC# / help
17mo ago
Wpf RichTextBox styling
C#CC# / help
3y ago
WPF button animation
C#CC# / help
13mo ago
✅ WPF button animation
C#CC# / help
13mo ago