So instead of sayingNumericYAxis xmYAxis = new NumericYAxis();xmYAxis.MinimumValue = 0;xmYAxis.MaximumValue = 2000;I would like to bind it an object of...Class AxisRangeObject{ public float MaxYAxisRange { get; set; } public float MinYAxisRange { get; set; }}Is it possible at all?
Great. That did it.
You can bind the Visibility property on the AxisLabelSetting like,
NumericYAxis ny = new NumericYAxis();AxisLabelSettings ls = ny.LabelSettings as AxisLabelSettings ;BindingOperations.SetBinding(ls, AxisLabelSettings.VisibilityProperty, new Binding("Visible") { Source = vobject });
Where "vobject" is the instance of the VisbilityObject you need to bind to and implements INotifyPropertyChanged.
Simillarly, you can bind AxisLabelSettings.Location property like ,
NumericYAxis ny = new NumericYAxis(); AxisLabelSettings ls = ny.LabelSettings as AxisLabelSettings; BindingOperations.SetBinding(ls, AxisLabelSettings.LocationProperty, new Binding("Location") { Source =lobject });
Where "lobject" is an instance of LocationObject you need to bind to and implements INotifyPropertyChanged.
-Shilpa
Cool that worked. Is there someway I can bind for AxisLabelSettings.Location and visible property.
You want to set up the bindings in the code behind?
You could do something like this:
var yAxis = new NumericYAxis(); yAxis.SetBinding(NumericAxisBase.MinimumValueProperty, new Binding("MinYAxisRange") { Source = rangeObject }); yAxis.SetBinding(NumericAxisBase.MaximumValueProperty, new Binding("MaxYAxisRange") { Source = rangeObject });
where rangeObject is the instance of the AxisRangeObject you want to bind to. Note for updates to actually pass through the binding, you would have to make your AxisRangeObject class implement INotifyPropertyChanged.
-Graham