diff --git a/Ghis.Controls/Charts/ChartLines.cs b/Ghis.Controls/Charts/ChartLines.cs index d097a32..47b85e5 100644 --- a/Ghis.Controls/Charts/ChartLines.cs +++ b/Ghis.Controls/Charts/ChartLines.cs @@ -50,8 +50,7 @@ protected override void OnRender(DrawingContext drawingContext) public static void OnVerticalAxisTickValuesChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { - ChartLines obj = sender as ChartLines; - if (obj != null && obj.VerticalAxisTickPositions != null) + if (sender is ChartLines obj && obj.VerticalAxisTickPositions != null) { obj.InvalidateVisual(); obj.VerticalAxisTickPositions.CollectionChanged += new NotifyCollectionChangedEventHandler(obj.VerticalAxisTickPositions_CollectionChanged); diff --git a/Ghis.Controls/Charts/ValueExtractor.cs b/Ghis.Controls/Charts/ValueExtractor.cs index c3fd8e8..0c66966 100644 --- a/Ghis.Controls/Charts/ValueExtractor.cs +++ b/Ghis.Controls/Charts/ValueExtractor.cs @@ -37,15 +37,15 @@ private static void OnItemsChanged(DependencyObject sender, DependencyPropertyCh } // ValueExtractor v = sender as ValueExtractor; // ItemCollection oldItems = args.OldValue as ItemCollection; - ItemCollection newItems = args.NewValue as ItemCollection; + ItemCollection? newItems = args.NewValue as ItemCollection; if (args.OldValue is INotifyCollectionChanged oldItems) { - oldItems.CollectionChanged -= new NotifyCollectionChangedEventHandler(v.OnItemsCollectionChanged); + oldItems.CollectionChanged -= new NotifyCollectionChangedEventHandler(v.OnItemsCollectionChanged!); } if (v.Items is INotifyCollectionChanged vItems) { - vItems.CollectionChanged += new NotifyCollectionChangedEventHandler(v.OnItemsCollectionChanged); + vItems.CollectionChanged += new NotifyCollectionChangedEventHandler(v.OnItemsCollectionChanged!); if (v.ValuePath is not null) { v.GenerateValueList();