Use AddOwner for MapBase.Foreground

This commit is contained in:
ClemensFischer 2024-05-24 15:14:05 +02:00
parent 3c907c3345
commit 197f004eeb
10 changed files with 45 additions and 60 deletions

View file

@ -46,5 +46,12 @@ namespace MapControl
return property;
}
public static StyledProperty<TValue> AddOwner<TOwner, TValue>(
StyledProperty<TValue> property)
where TOwner : AvaloniaObject
{
return property.AddOwner<TOwner>();
}
}
}

View file

@ -6,6 +6,7 @@ global using Avalonia;
using Avalonia.Animation;
using Avalonia.Animation.Easings;
using Avalonia.Controls;
using Avalonia.Controls.Documents;
using Avalonia.Media;
using Avalonia.Styling;
using System.Threading;
@ -15,6 +16,9 @@ namespace MapControl
{
public partial class MapBase
{
public static readonly StyledProperty<IBrush> ForegroundProperty =
DependencyPropertyHelper.AddOwner<MapBase, IBrush>(TextElement.ForegroundProperty);
public static readonly StyledProperty<Easing> AnimationEasingProperty =
DependencyPropertyHelper.Register<MapBase, Easing>(nameof(AnimationEasing), new QuadraticEaseOut());

View file

@ -17,6 +17,10 @@
<DefineConstants>AVALONIA</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\MapControl.snk" Link="MapControl.snk" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Shared\*.cs" />
<Compile Remove="..\Shared\BindingHelper.cs" />
@ -33,10 +37,6 @@
<Compile Remove="..\Shared\ViewTransform.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\MapControl.snk" Link="MapControl.snk" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.10" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0" />