This commit is contained in:
ClemensFischer 2024-05-21 14:39:53 +02:00
parent 5bc9c73fad
commit 4113104eff
3 changed files with 4 additions and 12 deletions

View file

@ -2,9 +2,10 @@
using Avalonia.Controls;
using System;
#pragma warning disable AVP1001 // The same AvaloniaProperty should not be registered twice
namespace MapControl
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1001")]
public static class DependencyPropertyHelper
{
public static StyledProperty<TValue> Register<TOwner, TValue>(
@ -43,13 +44,5 @@ namespace MapControl
return property;
}
public static DirectProperty<TOwner, TValue> RegisterReadOnly<TOwner, TValue>(
string name,
Func<TOwner, TValue> getter)
where TOwner : AvaloniaObject
{
return AvaloniaProperty.RegisterDirect(name, getter);
}
}
}

View file

@ -54,7 +54,7 @@ namespace MapControl
(map, value) => map.CoerceHeadingProperty(value));
public static readonly DirectProperty<MapBase, double> ViewScaleProperty =
DependencyPropertyHelper.RegisterReadOnly<MapBase, double>(nameof(ViewScale), map => map.ViewScale);
AvaloniaProperty.RegisterDirect<MapBase, double>(nameof(ViewScale), map => map.ViewScale);
private CancellationTokenSource centerCts;
private CancellationTokenSource zoomLevelCts;

View file

@ -8,6 +8,7 @@ using Microsoft.UI.Xaml;
#else
using Windows.UI.Xaml;
#endif
#pragma warning disable IDE0060 // Remove unused parameter
namespace MapControl
@ -43,5 +44,3 @@ namespace MapControl
}
}
}
#pragma warning restore IDE0060