how to change set for colors in RadStackedDataBar programmatically?

2 posts, 0 answers
  1. Navneet
    Navneet avatar
    2 posts
    Member since:
    Nov 2013

    Posted 19 Jan 2014 Link to this post

    How can I do the same thing of building a BrushCollection and assigning to RadStackedDataBar programmatically in code behind. Thanks for answers.

              <SolidColorBrush Color="SlateBlue" />
              <SolidColorBrush Color="AntiqueWhite" />
              <SolidColorBrush Color="Aqua" />
              <SolidColorBrush Color="Green" />
              <SolidColorBrush Color="Blue" />

  2. Martin Ivanov
    Martin Ivanov avatar
    2164 posts

    Posted 22 Jan 2014 Link to this post

    Hello Navneet,

    You can accomplish your requirement by adding the brushes in the BarBrushes collection of the StackedDataBar. Please, note that by default the collection holds several brushes, which you will first
    need to remove, otherwise they will be applied before your brushes. Take a look at the code sample demonstrating this approach:
    public MainWindow()
        // Set the items source
        this.xStackedDataBar.ItemsSource = new ObservableCollection<double>
            -10, 2, 3, 4, 10
        // Clear the default brushes
        // Add new brushes

    On a side note, I noticed that you have opened the same thread in the Chart section of the forum, but I think it would be better if we continue the communication for the StackedDataBar in the DataBar section. That's why we are going to remove the other thread. However, please feel free to open a new thread in the Chart section if you have any Chart-related questions.

    Martin Ivanov
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top