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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:06:54+00:00 2026-05-15T04:06:54+00:00

I am making a bar chart and I want two separate gradients for each

  • 0

I am making a bar chart and I want two separate gradients for each bar. First I want a gradient to go from top to bottom solid red to transparent red. I want to paint over the top of that a gradient that goes from right to left, black to opaque.

So – In the bottom left we should have;

  • Bottom left – Alpha 0
  • Bottom right – Alpha 0
  • Top left – Alpha 255 Colour Red
  • Top Right – Alpha 255 Colour Black

So in effect I want to take a solid colour, add a left to right gradient to black then take the output of that and add a top to bottom gradient to transparency.

All this and I want it to be in a single brush, is this even possible?

  • 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-15T04:06:55+00:00Added an answer on May 15, 2026 at 4:06 am

    Yes. Use a VisualBrush whose Visual is a Rectangle inside a Border to combine the other two brushes.

    Something like this:

    <LinearGradientBrush x:Key="UnderBrush" EndPoint="0,1"> 
      <GradientStop Color="#FFFF0000" Offset="0" /> 
      <GradientStop Color="#00FF0000" Offset="1" /> 
    </LinearGradientBrush> 
    
    <LinearGradientBrush x:Key="OverBrush" EndPoint="1,0"> 
      <GradientStop Color="#00000000" Offset="0" /> 
      <GradientStop Color="#FF000000" Offset="1" /> 
    </LinearGradientBrush> 
    
    <VisualBrush x:Key="CombinedBrush">
      <VisualBrush.Visual>
        <Border Background="{StaticResource UnderBrush}">
          <Rectangle Fill="{StaticResource OverBrush}" Width="1" Height="1" />
        </Border>
      </VisualBrush.Visual>
    </VisualBrush>
    

    CombinedBrush can be used to paint your bars, and you will get the effect you describe.

    Silverlight version

    Since Silverlight has no VisualBrush you must build a WritableBitmap in code and use it with an ImageBrush:

    <ImageBrush x:Key="CombinedBrush">
      <my:VisualBrushSimulator.Visual>
        <Border Background="{StaticResource UnderBrush}">
          <Rectangle Fill="{StaticResource OverBrush}" Width="1" Height="1" />
        </Border>
      </my:VisualBrushSimulator.Visual>
    </ImageBrush>
    

    Here is how the VisualBrushSimulator might be implemented:

    public class VisualBrushSimulator : DependencyObject
    {
      public Visual GetVisual(DependencyObject obj) { return (Visual)obj.GetValue(VisualProperty); }
      public void SetVisual(DependencyObject obj, Visual value) { obj.SetValue(VisualProperty, value); }
      public static readonly DependencyProperty VisualProperty = DependencyProperty.RegisterAttached("Visual", typeof(Visual), typeof(VisualBrushSimulator), new PropertyMetadata
      {
        PropertyChangedCallback = (obj, e) =>
        {
          int width=1000;
          int height=1000;
          var bitmap = new WritableBitmap(width, height);
          bitmap.Render((Visual)e.NewValue, new ScaleTransform { ScaleX = width, ScaleY = height });
          ((ImageBrush)obj).ImageSource = bitmap;
        }
      });
    }
    

    Note that this is not a true VisualBrush simulation, since changes to the Visual do not affect the brush.

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

Sidebar

Related Questions

Currently i am looking into making a bar chart in my WPF application. Although
I'm making a navigation bar like Twitter, but I want that one div inside
I have some problems with making a stacked bar chart in ggplot2. I know
I'm making a website and I have this HTML for a bar chart: <div
I am making a bar graph in visifire and I want to make a
i'm making app based on tab bar with two tabs. My problem is that
Im making a iPhone app and want to make a seek bar for a
I'm making a tab bar iphone app and I wanted to have an animated
I'm pretty new to HTML and CSS. I'm making a menu bar horizontal and
Making my first steps with NHibernate, I'm trying to have it creating my Tables

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.