WinUI value converters

This commit is contained in:
ClemensFischer 2025-08-14 13:11:25 +02:00
parent e006cbedc6
commit 933cb7f2ba
6 changed files with 83 additions and 32 deletions

View file

@ -1,22 +0,0 @@
using System;
#if UWP
using Windows.UI.Xaml.Data;
#elif WINUI
using Microsoft.UI.Xaml.Data;
#endif
namespace MapControl
{
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)
{
throw new NotSupportedException();
}
}
}

View file

@ -0,0 +1,61 @@
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();
}
}
}