Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Dynamically Assigning Color for Background :: QuantitativeScale
posted

Is there a way to change the background of a QuantitativeScale or other parts of  a Bullet graph programmically.

I'm probably not approaching it correctly, but I was looking for something like:

    xamBulletGraph1.Scale.QuantitativeScale.Background = "<color>";

I'm guessing I have to some type of Binding, like the other dynamic data - but do I have to create a "model" for this too? Or can I bind it straight to a variable?

Baby steps.... :-)

 

Parents
No Data
Reply
  • 895
    Verified Answer
    posted

    Hello,

    The Scale property returns the Quantitative Scale so you can change the background like this:

    xamBulletGraph1.Scale.Background = new SolidColorBrush(Colors.Magenta);

    The Background property is of type Brush and the snippet assigns a SolidColorBrush, which uses the predefined color Red - list with predefined colors.

    You can also use Infragistics.ColorConverter.FromString("#FF2582A9") to obtain a color from a string: 

    xamBulletGraph1.Scale.Background = new SolidColorBrush(Infragistics.ColorConverter.FromString("#FF2582A9"));
    

    Here are topics, which will guide you how to work with the Quantitative Scale and its Qualitative Ranges in code-behind -  Quantitative Scale and Qualitative Ranges 

    Thanks!

Children
No Data