Pre loader

Changing series colorand stroke thickness dynamically

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

If there a way to bind series color/thickness to a custom control so the line color and thickness changes dynamically when user select a different color/thickness? I will need use this with the MVVM dataseries API.

  • You must to post comments
0
0

Yes there is, you just have to bind RenderableSeries.SeriesColor and StrokeThickness to a property in the viewmodel.

e.g.

<s:SciChartSurface>
   <s:SciChartSurface.RenderableSeries>
      <s:FastLineRenderableSeries SeriesColor="{Binding Color}" StrokeThickness="{Binding StrokeThickness}"/>
   </s:SciChartSurface.RenderableSeries>
</s:SciChartSurface>

Then in a viewmodel

public class MyViewModel : INotifyPropertyChanged
{ 
    private int _strokeThickness = 1;
    private Color _color = Color.FromArgb(0xFF, 0xFF, 0x66, 0x00);

    public int StrokeThickness 
    { 
       get { return this._strokeThickness; } 
       set
       { 
           this._strokeThickness = value;
           OnPropertyChanged("StrokeThickness");
       }
    }

    public Color Color 
    { 
       get { return this._color; } 
       set
       {
           this._color = value;
           OnPropertyChanged("Color");
       }
    }

    protected void OnPropertyChanged(string prop)
    {
        var handler = PropertyChanged;
        if (handler != null)
        {
             handler(this, new PropertyChangedEventArgs(prop));
        }
    }
}

I hope this helps!

  • JQuan
    Sorry Andrew, I think I asked the question too simplistically and thus the simplistic answer. I actually figure it out. Thanks.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies