SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

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.