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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:04:12+00:00 2026-05-13T08:04:12+00:00

I am creating some wpf resource dictionaries with all the styles for an application!

  • 0

I am creating some wpf resource dictionaries with all the styles for an application! I have a few LinearGradientBrushes, where the color is set directly in the LinearGradientBrush reference as GradientStops. However, I want to have a predefined set of colors that I can use a a reference for each GradientStop, so that changing the color scheme for the application is a matter of changing the values of the SolidColorBrushes:

<SolidColorBrush Color="#5A5A5A" x:Key="colorbrushMedium" /> 
<SolidColorBrush Color="#222222" x:Key="colorbrushDark" />  


<LinearGradientBrush>
    <GradientStop Color="{StaticResource colorbrushMedium}"/>
    <GradientStop Color="{StaticResource colorbrushDark}" Offset="1"/>
</LinearGradientBrush>

With the code example above, I am getting the following error:

Cannot convert the value in attribute 'Color' to object of type 'System.Windows.Media.Color'. '#5A5A5A' is not a valid value for property 'Color'.  

The line it refers to is the line where <GradientStop Color="{StaticResource colorbrushMedium}"/> is defined.

Any ideas?

  • 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-05-13T08:04:12+00:00Added an answer on May 13, 2026 at 8:04 am

    Ok, I found the problem:

    Using Color and not SolidColorBrush..

    <Color x:Key="colorbrushMedium">#FF5A5A5A</Color>
    <Color x:Key="colorbrushDark">#FF222222</Color>
    <LinearGradientBrush>
        <GradientStop Color="{StaticResource colorbrushMedium}"/>
        <GradientStop Color="{StaticResource colorbrushDark}" Offset="1"/>
    </LinearGradientBrush>
    

    This seems to solve my problem!

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

Sidebar

Related Questions

I'm creating a simple drawing application using WPF. I've run into some strange behaviour
I have a WPF application in which a thread checks some value. In certain
I'm creating a WPF application, for which all users must be authenticated to an
I currently do a lot of WPF development and have started creating some basic
I have an application I am creating in WPF, using MVVM pattern. In this
I'm creating some desktop application using WPF(C# .net). I want to create it as
Does anyone have a good example of creating a WPF custom control or some
I am having some serious trouble creating a WPF TreeView with an Object databinding.
When creating a UserControl in WPF, I find it convenient to give it some
I'm creating a standalone WPF app with multi-language support. I've found some great resources

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.