Combine TypeConverters and IValueConverters

This commit is contained in:
ClemensFischer 2025-08-19 13:14:08 +02:00
parent 12d13465e9
commit 4b60e7dde5
5 changed files with 64 additions and 77 deletions

View file

@ -17,11 +17,6 @@
</ItemGroup>
<ItemGroup>
<Compile Remove="..\Shared\TypeConverters.cs" />
</ItemGroup>
<ItemGroup>
<!-- Directly referencing "Microsoft.Web.WebView2 is a workaround for a bug in WindowsAppSDK, https://github.com/microsoft/WindowsAppSDK/issues/4807 -->
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250606001" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.4948" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.8" />

View file

@ -1,61 +0,0 @@
using System;
#if UWP
using Windows.UI.Xaml.Data;
#elif WINUI
using Microsoft.UI.Xaml.Data;
#endif
namespace MapControl
{
public class LocationConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return Location.Parse(value.ToString());
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return value.ToString();
}
}
public class LocationCollectionConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return LocationCollection.Parse(value.ToString());
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return value.ToString();
}
}
public class BoundingBoxConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return BoundingBox.Parse(value.ToString());
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return value.ToString();
}
}
public class TileSourceConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return TileSource.Parse(value.ToString());
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return value.ToString();
}
}
}