protected override void OnHostChanged(PlotPanel host)
 {
     base.OnHostChanged(host);
     if (this.host != null)
     {
         try
         {
             RemoveElements((bool)GetValue(UseDirect2DProperty));
             this.host = host;
             BindingOperations.ClearBinding(this, Plot2DCurve.UseDirect2DProperty);
         }
         catch (Exception)
         {
             // Just swallow any exception
         }
     }
     else
     {
         this.host = host;
     }
     if (this.host != null)
     {
         AddElements();
         curve.Transform(xAxis.GraphTransform, yAxis.GraphTransform);
         // Add binding:
         bindingDirect2D = new Binding("UseDirect2D")
         {
             Source = host, Mode = BindingMode.OneWay
         };
         BindingOperations.SetBinding(this, Plot2DCurve.UseDirect2DProperty, bindingDirect2D);
     }
     SetBounds();
 }