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

  • Home
  • SEARCH
  • 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 7867747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:47:28+00:00 2026-06-03T00:47:28+00:00

Consider the value converter below. I can easily pass values such as Red and

  • 0

Consider the value converter below. I can easily pass values such as “Red” and “Green” to my converter, but how could I pass a brush defined in XAML?

How do I bind FalseBrush to MyNiceBrush?

<local:MyBrushConverter x:Key="BackgroundConverter" FalseBrush="Red" TrueBrush="Green" />

<LinearGradientBrush x:Key="MyNiceBrush" StartPoint="0,0" EndPoint="0,1">
    <GradientStop Offset="0" Color="#4C7F00" />
    <GradientStop Offset="1" Color="#A0B529" />
</LinearGradientBrush>

In XAML, I bind my object’s property to this converter: Background="{Binding MyClass.TrueOrFalseProperty, Converter={StaticResource BackgroundConverter} ...

Here’s my converter:

public class MyBrushConverter : IValueConverter
{
    public Brush FalseBrush { get; set; }
    public Brush TrueBrush { get; set; }

    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        if ((bool)value)
            return TrueBrush;
        else
            return FalseBrush;
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}
  • 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-03T00:47:29+00:00Added an answer on June 3, 2026 at 12:47 am
    <local:MyBrushConverter x:Key="BackgroundConverter" FalseBrush={StaticResource MyNiceBrush} TrueBrush="Green" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I pass a value from one screen to its previous screen? Consider
Consider this table on SQL Server wordID aliasID value =========================== 0 0 'cat' 1
Consider these three mysql statements: select * from Users; select id, title, value from
Background Consider the following: template <unsigned N> struct Fibonacci { enum { value =
Consider: <?php define('my_const', 100); echo <<<MYECHO <p>The value of my_const is {my_const}.</p> MYECHO; ?>
Consider the scenario I have values assigned like these Amazon -1 Walmart -2 Target
Consider this Python code for printing a list of comma separated values for element
Consider the following code: List<double> l = new List<double>(); //add unknown number of values
Consider this example: l = [1, 2, 3, 4, 5] for values in l:
I have a function accepting an enum value as parameter. As an example, consider

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.