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.
- JQuan asked 11 years ago
- You must login to post comments
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!
- Andrew Burnett-Thompson answered 11 years ago
-
Sorry Andrew, I think I asked the question too simplistically and thus the simplistic answer. I actually figure it out. Thanks.
- You must login to post comments
Please login first to submit.