Avalonia sample application

This commit is contained in:
ClemensFischer 2024-05-29 17:19:03 +02:00
parent 5a738f7a71
commit 8da77b7a15
2 changed files with 21 additions and 18 deletions

View file

@ -68,32 +68,20 @@ namespace SampleApplication
} }
}); });
} }
AddTestLayers();
} }
partial void AddTestLayers();
private void OnMapDoubleTapped(object sender, TappedEventArgs e) private void OnMapDoubleTapped(object sender, TappedEventArgs e)
{
if (e.Source == map)
{ {
map.TargetCenter = map.ViewToLocation(e.GetPosition(map)); map.TargetCenter = map.ViewToLocation(e.GetPosition(map));
} }
}
private void ResetHeadingButtonClick(object? sender, Avalonia.Interactivity.RoutedEventArgs e) private void ResetHeadingButtonClick(object sender, Avalonia.Interactivity.RoutedEventArgs e)
{ {
map.TargetHeading = 0d; map.TargetHeading = 0d;
} }
} }
public class MapHeadingToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (double)value != 0d;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
} }

View file

@ -5,6 +5,8 @@ using System.Globalization;
using Microsoft.UI.Xaml.Data; using Microsoft.UI.Xaml.Data;
#elif UWP #elif UWP
using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Data;
#elif AVALONIA
using Avalonia.Data.Converters;
#endif #endif
namespace SampleApplication namespace SampleApplication
@ -37,4 +39,17 @@ namespace SampleApplication
return ConvertBack(value, targetType, parameter, ""); return ConvertBack(value, targetType, parameter, "");
} }
} }
public class MapHeadingToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (double)value != 0d;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
} }