Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Source/OxyPlot.Xamarin.Forms.Platform.MacOS/PlotViewRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.P
return;
}

this.DetachModelFromView();

var plotView = new PlotView
{
Model = this.Element.Model,
Expand All @@ -78,6 +80,7 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE

if (e.PropertyName == Xamarin.Forms.PlotView.ModelProperty.PropertyName)
{
this.DetachModelFromView();
this.Control.Model = this.Element.Model;
}

Expand All @@ -95,5 +98,14 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE
this.Control.InvalidatePlot (false);
}
}

void DetachModelFromView()
{
var model = base.Element.Model as OxyPlot.IPlotModel;
if (model != null)
{
model.AttachPlotView(null);
}
}
}
}