/// <summary> /// Initializes a new instance of the <see cref="AxisBase<T>"/> class. /// </summary> /// <param name="axisControl">The axis control.</param> /// <param name="convertFromDouble">The convert from double.</param> /// <param name="convertToDouble">The convert to double.</param> protected AxisBase(AxisControl <T> axisControl, Func <double, T> convertFromDouble, Func <T, double> convertToDouble) { if (axisControl == null) { throw new ArgumentNullException("axisControl"); } if (convertFromDouble == null) { throw new ArgumentNullException("convertFromDouble"); } if (convertToDouble == null) { throw new ArgumentNullException("convertToDouble"); } this.convertToDouble = convertToDouble; this.convertFromDouble = convertFromDouble; this.axisControl = axisControl; axisControl.MakeDependent(); axisControl.ConvertToDouble = convertToDouble; axisControl.ScreenTicksChanged += axisControl_ScreenTicksChanged; Content = axisControl; Binding binding = new Binding("Background"); binding.Source = this; axisControl.SetBinding(Control.BackgroundProperty, binding); Loaded += OnLoaded; }
/// <summary> /// Initializes a new instance of the <see cref="AxisBase<T>"/> class. /// </summary> /// <param name="axisControl">The axis control.</param> /// <param name="convertFromDouble">The convert from double.</param> /// <param name="convertToDouble">The convert to double.</param> protected AxisBase(AxisControl <T> axisControl, Func <double, T> convertFromDouble, Func <T, double> convertToDouble) { if (axisControl == null) { throw new ArgumentNullException("axisControl"); } if (convertFromDouble == null) { throw new ArgumentNullException("convertFromDouble"); } if (convertToDouble == null) { throw new ArgumentNullException("convertToDouble"); } this.convertToDouble = convertToDouble; this.convertFromDouble = convertFromDouble; this.axisControl = axisControl; axisControl.ConvertToDouble = convertToDouble; Content = axisControl; Binding binding = new Binding("Background"); binding.Source = this; axisControl.SetBinding(Control.BackgroundProperty, binding); Loaded += OnLoaded; axisControl.loadedPartsChanged += new EventHandler(axisControl_loadedPartsChanged); }
/// <summary> /// Initializes a new instance of the <see cref="DateTimeAxis"/> class. /// </summary> public DateTimeAxis() : base(new DateTimeAxisControl(), DoubleToDate, dt => dt.Ticks / 10000000000.0) { AxisControl.SetBinding(MajorLabelBackgroundBrushProperty, new Binding("MajorLabelBackgroundBrush") { Source = this }); AxisControl.SetBinding(MajorLabelRectangleBorderPropertyProperty, new Binding("MajorLabelRectangleBorderProperty") { Source = this }); }