SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components
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.
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!
Please login first to submit.