mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Avalonia sample application
This commit is contained in:
parent
5a738f7a71
commit
8da77b7a15
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue