Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
570
How can I bind Axis max and min values to an object in code?
posted
So instead of saying

NumericYAxis
 xmYAxis = new NumericYAxis();
xmYAxis.MinimumValue = 0;
xmYAxis.MaximumValue = 2000;

I would like to bind it an object of...

Class AxisRangeObject
{
 public float MaxYAxisRange { getset; }
public float MinYAxisRange { getset; }
}

Is it possible at all?
Parents
No Data
Reply
  • 30692
    Verified Answer
    Offline posted

    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

Children