using OxyPlot.Xamarin.Forms; using OxyPlot.Xamarin.Forms.Platform.iOS; using global::Xamarin.Forms; using global::Xamarin.Forms.Platform.iOS; // Exports the renderer. [assembly: ExportRenderer(typeof(PlotView), typeof(PlotViewRenderer))] namespace OxyPlot.Xamarin.Forms.Platform.iOS { using System.ComponentModel; using OxyPlot.Xamarin.iOS; /// /// Provides a custom renderer for Xamarin.iOS. /// public class PlotViewRenderer : ViewRenderer { /// /// Raises the element changed event. /// /// The event arguments. protected override void OnElementChanged(ElementChangedEventArgs e) { base.OnElementChanged(e); if (e.OldElement != null || this.Element == null) { return; } var plotView = new PlotView { Model = this.Element.Model, Controller = this.Element.Controller }; if (this.Element.Model.Background.IsVisible()) { plotView.BackgroundColor = this.Element.Model.Background.ToUIColor(); } this.SetNativeControl(plotView); } /// /// Raises the element property changed event. /// /// The sender. /// The event arguments. protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (this.Element == null || this.Control == null) { return; } if (e.PropertyName == Xamarin.Forms.PlotView.ModelProperty.PropertyName) { this.Control.Model = this.Element.Model; } if (e.PropertyName == Xamarin.Forms.PlotView.ControllerProperty.PropertyName) { this.Control.Controller = this.Element.Controller; } } } }