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 8495985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:43:32+00:00 2026-06-10T23:43:32+00:00

I have a WPF usercontrol with a Button. I’ve replicated the standard button shading

  • 0

I have a WPF usercontrol with a Button. I’ve replicated the standard button shading of System.Windows.Media.LinearGradientBrush by Extract Value to Resource to get sight of the default setup in resources

I’ve then copied the resource but substituted the default colours to the ones I want

    <LinearGradientBrush EndPoint="0,1">
        <GradientStop Color="#FFF3F3F3" Offset="0" />
        <GradientStop Color="#FFEBEBEB" Offset="0.5" />
        <GradientStop Color="#FFDDDDDD" Offset="0.5" />
        <GradientStop Color="#FFCDCDCD" Offset="1" />
    </LinearGradientBrush>

I’ve then deleted the resource so my full XAML looks like

<UserControl x:Class="Project.Detail"
             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" 
             mc:Ignorable="d" 
             d:DesignHeight="30" d:DesignWidth="800" BorderBrush="#FF5380E7" BorderThickness="0,0,0,1" >
    <Grid Height="30" Width="800">
        <Button Height="30" HorizontalAlignment="Left" Margin="254,0,0,0" Name="bOption3" VerticalAlignment="Top" Width="50" Click="bOption_Click" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="10" FontStretch="SemiCondensed">
            <Button.Background>
                <LinearGradientBrush EndPoint="0,1">
                    <GradientStop Color="#FFD2DEF9" Offset="0" />
                    <GradientStop Color="#FFC5D4F7" Offset="0.5" />
                    <GradientStop Color="#FFAEC3F4" Offset="0.5" />
                    <GradientStop Color="#FF8FACF0" Offset="1" />
                </LinearGradientBrush>
            </Button.Background>
        </Button>
    </Grid>
</UserControl>

In the designer I see the colours I’ve set with the correct gradient but when I build and run the buttons are the default grey colour.

Can anyone tell what I am doing wrong?

EDIT:

I want to retain the default button style except the initial state background I want my own colours. I’ve now tried adding specific resources for the background

<UserControl.Resources>
    <LinearGradientBrush x:Key="NewBackground" EndPoint="0,1">
        <GradientStop Color="#FFD2DEF9" Offset="0" />
        <GradientStop Color="#FFC5D4F7" Offset="0.5" />
        <GradientStop Color="#FFAEC3F4" Offset="0.5" />
        <GradientStop Color="#FF8FACF0" Offset="1" />
    </LinearGradientBrush>
</UserControl.Resources>

and then adding

<Button Height="30" HorizontalAlignment="Left" Margin="360,0,0,0"  Background="{StaticResource NewBackground}">

Again in the designer I can see the colour being applied but when the app runs it has the default grey colour at all times.

Button in design mode

enter image description here

Button in App

enter image description here

I now have a few questions

  1. Is there a simple way to change just 1 property of the default button rather than create complete new style?

  2. If I have to recreate a full style where can I access all the default properties to make it look the same?

Thanks

  • 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-10T23:43:34+00:00Added an answer on June 10, 2026 at 11:43 pm
    1. Yes you can for certain properties and it depends. Say if you want to change the FontSize, FontFamily, FontSize, FontStretch, etc. There are some attach properties provided by WPF to override it e.g.

      <Grid TextElement.FontFamily=""/>
      or <Button TextElement.FontFamily=""/>

    2. You can try going to Expression blend and extract the default template of WPF controls. Customize the templates from there.

    More info can be found here

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

Sidebar

Related Questions

I have an interesting problem. I've created a WPF UserControl which contains a button
I have a WPF UserControl with binding converters referenced like this: <UserControl x:Class=MyControl x:Name=MyControl
Background: I have a WPF UserControl (MainControl - not shown in code below) that
I have many dependency properties in my WPF usercontrol and many of them are
I have a WPF TabControl which displays UserControl s. Some UserControl s are larger
WPF controls have certain properties (UserControl.Resources, UserControl.CommandBindings) that can have items added to them
I have created a UserControl in WPF. This user control consists of a border,
New to wpf and through a learning curve. I have a userControl with a
I have a WPF UserControl nested inside an ElementHost in a WinForm UserControl intended
I have a ListView in my WPF UserControl using an ItemTemplate to display the

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.