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

The Archive Base Latest Questions

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

EDIT: I had hex value(string) that i converted to a Brush hence it did

  • 0

EDIT:
I had hex value(string) that i converted to a Brush hence it did not take my color the following like takes my colors succesfully:

(Color)ColorConverter.ConvertFromString(colorArray[0])

The only problem remaining is the scaling (with colors).

My color bars seem to be transparent (once again) but now with the proper color attached to each bar. Also at start up of my program all the 6 bars displayed (but they should not get displayed because it has no value yet).
Code:

<Border Height="30" Margin="15" Grid.RowSpan="6" >
                <Border.Background>
                    <LinearGradientBrush StartPoint="0.0,0" EndPoint="1.0,0">
                        <GradientStopCollection>
                            <GradientStop Offset="0.0" Color="{Binding FillBar, UpdateSourceTrigger=PropertyChanged}" />

                            <GradientStop Offset="{Binding Value, UpdateSourceTrigger=PropertyChanged}" />

                        </GradientStopCollection>
                    </LinearGradientBrush>
                </Border.Background>
            </Border>

enter image description here

How exactly do i get rid of the transparent color fading at the middle/end of the bar?

When i try adding the same color to the second Offset i am getting Full length bars (100%) and the scaling is nullified again.


I have the following ItemsControl with a DateTemplate that represents a simple bar chart:

<ItemsControl x:Name="icGrafiek"  
            Margin="0,0,0,0" 
            ItemsSource="{Binding Source={StaticResource Grafiek}}"
            ItemTemplate="{DynamicResource GrafiekItemTemplate}" 
            RenderTransformOrigin="1,0.5" Grid.RowSpan="6" Grid.Column="1"/>

<DataTemplate x:Key="GrafiekItemTemplate">
            <Grid>
            <Border Height="30" Margin="15" Grid.RowSpan="6" >
                <Border.Background>

                    <LinearGradientBrush StartPoint="0.0,0" EndPoint="1.0,0">
                        <GradientStopCollection>
                            <GradientStop Offset="0.0" Color="#fff" />

                            <GradientStop Offset="{Binding Value, UpdateSourceTrigger=PropertyChanged}" 
                                          Color="{Binding Fill, UpdateSourceTrigger=PropertyChanged}" />

                            <GradientStop Offset="{Binding Value, UpdateSourceTrigger=PropertyChanged}" 
                                          Color="{Binding Fill, UpdateSourceTrigger=PropertyChanged}" />                                                          
                        </GradientStopCollection>
                    </LinearGradientBrush>                
                </Border.Background>
            </Border>
        </Grid>
    </DataTemplate>

The problem is actually displaying the colors of my bars of my chart control.

The following gets displayed:
GradientBrush

Before the GradientBrush i use a Rectangle instead to create the bars. I used the GradientBrush so i could scale my bars (the Binding Value returns a List with values between 1.0 and 0 so they get scaled). With a rectangle i was stuck and had no way of scaling my bars according to the 1.0 – 0 values that were being returned.

Old code with Rectangle:

 <DataTemplate x:Key="GrafiekItemTemplate">
            <Grid>
                <Rectangle StrokeThickness="0" Height="30"  
                           Margin="15" 
                           HorizontalAlignment="Left" 
                           VerticalAlignment="Stretch"
                           Width="{Binding Value, UpdateSourceTrigger=PropertyChanged}" 
                           Fill="{Binding Fill, UpdateSourceTrigger=PropertyChanged}">
                    <Rectangle.LayoutTransform>
                        <ScaleTransform ScaleX="20" />
                    </Rectangle.LayoutTransform>
                </Rectangle>
            </Grid>
    </DataTemplate>

When i used a Rectangle with the Fill Binding my chart looked like this (like it should):
The Fill Binding basically returns a list with Hex values to obtain these colors.

Rectangle


How do i fill up the LinearGradientBrush with the colors showed in the picture above (array that holds the hex values of the colors)? The order of the colors stays the same.

Or if this is not possible how do i actually pull it off with the rectangle?
If there is a other solution with rectangle i can just implement that again.

Best Regards PeterP.

  • 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:16:45+00:00Added an answer on June 3, 2026 at 12:16 am

    Peter,

    In the rectangle you were using data’s Fill property bound to the rectangle’s Fill property. Both of them are of type Brush (or derived type)

    In case of the gradient stop, it is expecting a Color object, not a brush, so you can create another data property of type Color instead.

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

Sidebar

Related Questions

EDIT: I had hex value(string) that i converted to a Brush hence it did
EDIT: I had made a mistake during the debugging session that lead me to
Answer solved in edit below I had this piece of code Dictionary<Merchant, int> remaingCards
I posted another one on this,, but i had to edit it really much...
EDIT: OK, I believe the following solutions are valid: Use the jQuery AOP plugin.
EDIT I had a problem a while ago writing a program in C which
Edit: I had some code posted here but I couldn't get it to reproduce.
EDIT : I had tried these two ways before - List<double> doubleList = stringList.ConvertAll(x
In a C# windows app I handle HEX Strings. A single HEX string will
I had an idea to programmatically generate matching color schemes however I need to

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.