diff --git a/Source/Directory.Build.props b/Source/Directory.Build.props
index cc2a554..6b85769 100644
--- a/Source/Directory.Build.props
+++ b/Source/Directory.Build.props
@@ -1,5 +1,5 @@
- 11.0.0-preview4
+ 11.0.0-preview5
diff --git a/Source/Examples/Avalonia/ExampleBrowser/MainWindow.xaml b/Source/Examples/Avalonia/ExampleBrowser/MainWindow.xaml
index d720e6a..4495391 100644
--- a/Source/Examples/Avalonia/ExampleBrowser/MainWindow.xaml
+++ b/Source/Examples/Avalonia/ExampleBrowser/MainWindow.xaml
@@ -30,7 +30,7 @@
-
+
diff --git a/Source/OxyPlot.Avalonia/Axes/LinearColorAxis.cs b/Source/OxyPlot.Avalonia/Axes/LinearColorAxis.cs
index 5546b82..ba296c1 100644
--- a/Source/OxyPlot.Avalonia/Axes/LinearColorAxis.cs
+++ b/Source/OxyPlot.Avalonia/Axes/LinearColorAxis.cs
@@ -136,7 +136,7 @@ protected override void SynchronizeProperties()
{
base.SynchronizeProperties();
var axis = InternalAxis as Axes.LinearColorAxis;
- Contract.Requires(axis != null);
+ //Contract.Requires(axis != null);
if (GradientStops != null)
{
axis.Palette = GradientStops.Count > 2
diff --git a/Source/OxyPlot.Avalonia/OxyPlot.Avalonia.csproj b/Source/OxyPlot.Avalonia/OxyPlot.Avalonia.csproj
index 9fa6b70..d8d3f37 100644
--- a/Source/OxyPlot.Avalonia/OxyPlot.Avalonia.csproj
+++ b/Source/OxyPlot.Avalonia/OxyPlot.Avalonia.csproj
@@ -27,5 +27,6 @@
+
diff --git a/Source/OxyPlot.Avalonia/Plot.cs b/Source/OxyPlot.Avalonia/Plot.cs
index bcccd8b..eb9df9c 100644
--- a/Source/OxyPlot.Avalonia/Plot.cs
+++ b/Source/OxyPlot.Avalonia/Plot.cs
@@ -9,6 +9,7 @@
namespace OxyPlot.Avalonia
{
+ using global::Avalonia;
using global::Avalonia.Controls;
using global::Avalonia.LogicalTree;
using global::Avalonia.VisualTree;
@@ -182,7 +183,7 @@ private void SyncLogicalTree(NotifyCollectionChangedEventArgs e)
item.SetParent(this);
}
LogicalChildren.AddRange(e.NewItems.OfType());
- VisualChildren.AddRange(e.NewItems.OfType());
+ VisualChildren.AddRange(e.NewItems.OfType());
}
if (e.OldItems != null)
@@ -195,7 +196,7 @@ private void SyncLogicalTree(NotifyCollectionChangedEventArgs e)
foreach (var item in e.OldItems)
{
LogicalChildren.Remove((ILogical)item);
- VisualChildren.Remove((IVisual)item);
+ VisualChildren.Remove((Visual)item);
}
}
diff --git a/Source/OxyPlot.Avalonia/PlotBase.cs b/Source/OxyPlot.Avalonia/PlotBase.cs
index 127a0f3..fcd45c7 100644
--- a/Source/OxyPlot.Avalonia/PlotBase.cs
+++ b/Source/OxyPlot.Avalonia/PlotBase.cs
@@ -52,7 +52,7 @@ public abstract partial class PlotBase : TemplatedControl, IPlotView
///
/// The current tracker.
///
- private IControl currentTracker;
+ private Control currentTracker;
///
/// The grid.
@@ -101,7 +101,7 @@ protected PlotBase()
{
DisconnectCanvasWhileUpdating = true;
trackerDefinitions = new ObservableCollection();
- this.GetObservable(TransformedBoundsProperty).Subscribe(bounds => OnSizeChanged(this, bounds?.Bounds.Size ?? new Size()));
+ this.GetObservable(BoundsProperty).Subscribe(bounds => OnSizeChanged(this, bounds.Size));
}
///
@@ -134,7 +134,7 @@ Model IView.ActualModel
/// Gets the actual controller.
///
///
- /// The actual .
+ /// The actual .
///
IController IView.ActualController
{
@@ -458,10 +458,10 @@ private void OnSizeChanged(object sender, Size size)
/// Type of the relevant parent
/// The object.
/// The relevant parent.
- private Control GetRelevantParent(IVisual obj)
+ private Control GetRelevantParent(Visual obj)
where T : Control
{
- var container = obj.VisualParent;
+ var container = obj.GetVisualParent();
if (container is ContentPresenter contentPresenter)
{
diff --git a/Source/OxyPlot.Avalonia/Series/Series.cs b/Source/OxyPlot.Avalonia/Series/Series.cs
index 6d181cd..24dd975 100644
--- a/Source/OxyPlot.Avalonia/Series/Series.cs
+++ b/Source/OxyPlot.Avalonia/Series/Series.cs
@@ -227,17 +227,28 @@ protected void OnDataChanged()
(this.Parent as IPlot)?.ElementDataChanged(this);
}
- ///
- /// The on items source changed.
- ///
- /// Event args
- protected override void ItemsChanged(AvaloniaPropertyChangedEventArgs e)
+ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs e)
{
- base.ItemsChanged(e);
- SubscribeToCollectionChanged(e.OldValue as IEnumerable, e.NewValue as IEnumerable);
- OnDataChanged();
+ base.OnPropertyChanged(e);
+
+ if (e.Property == ItemsControl.ItemsProperty)
+ {
+ SubscribeToCollectionChanged(e.OldValue as IEnumerable, e.NewValue as IEnumerable);
+ OnDataChanged();
+ }
}
+ /////
+ ///// The on items source changed.
+ /////
+ ///// Event args
+ //protected override void ItemsCollectionChanged(AvaloniaPropertyChangedEventArgs e)
+ //{
+ // base.ItemsChanged(e);
+ // SubscribeToCollectionChanged(e.OldValue as IEnumerable, e.NewValue as IEnumerable);
+ // OnDataChanged();
+ //}
+
protected override void OnAttachedToLogicalTree(global::Avalonia.LogicalTree.LogicalTreeAttachmentEventArgs e)
{
base.OnAttachedToLogicalTree(e);
diff --git a/Source/OxyPlot.Avalonia/Utilities/ConverterExtensions.cs b/Source/OxyPlot.Avalonia/Utilities/ConverterExtensions.cs
index df18cd3..fb7ad58 100644
--- a/Source/OxyPlot.Avalonia/Utilities/ConverterExtensions.cs
+++ b/Source/OxyPlot.Avalonia/Utilities/ConverterExtensions.cs
@@ -434,7 +434,7 @@ public static OxyMouseWheelEventArgs ToMouseWheelEventArgs(this PointerWheelEven
{
return new OxyMouseWheelEventArgs
{
- Position = e.GetPosition(relativeTo).ToScreenPoint(),
+ Position = e.GetPosition(relativeTo as Visual).ToScreenPoint(),
ModifierKeys = Keyboard.Instance.GetModifierKeys(),
Delta = (int)(e.Delta.Y + e.Delta.X) * 120
};
@@ -448,7 +448,7 @@ public static OxyMouseWheelEventArgs ToMouseWheelEventArgs(this PointerWheelEven
/// A containing the converted event arguments.
public static OxyMouseDownEventArgs ToMouseDownEventArgs(this PointerPressedEventArgs e, IInputElement relativeTo)
{
- var point = e.GetCurrentPoint(relativeTo);
+ var point = e.GetCurrentPoint(relativeTo as Visual);
return new OxyMouseDownEventArgs
{
@@ -456,7 +456,7 @@ public static OxyMouseDownEventArgs ToMouseDownEventArgs(this PointerPressedEven
#pragma warning disable CS0618 // Type or member is obsolete
ClickCount = e.ClickCount,
#pragma warning restore CS0618 // Type or member is obsolete
- Position = e.GetPosition(relativeTo).ToScreenPoint(),
+ Position = e.GetPosition(relativeTo as Visual).ToScreenPoint(),
ModifierKeys = e.KeyModifiers.ToModifierKeys()
};
}
@@ -471,7 +471,7 @@ public static OxyMouseEventArgs ToMouseReleasedEventArgs(this PointerReleasedEve
{
return new OxyMouseEventArgs
{
- Position = e.GetPosition(relativeTo).ToScreenPoint(),
+ Position = e.GetPosition(relativeTo as Visual).ToScreenPoint(),
ModifierKeys = e.KeyModifiers.ToModifierKeys()
};
}
@@ -486,7 +486,7 @@ public static OxyMouseEventArgs ToMouseEventArgs(this PointerEventArgs e, IInput
{
return new OxyMouseEventArgs
{
- Position = e.GetPosition(relativeTo).ToScreenPoint(),
+ Position = e.GetPosition(relativeTo as Visual).ToScreenPoint(),
ModifierKeys = e.KeyModifiers.ToModifierKeys()
};
}