mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-06 15:05:50 +00:00
Version 4.14. Added support for .NET Core 3
This commit is contained in:
parent
a4fad94921
commit
23778280e1
35 changed files with 797 additions and 36 deletions
36
SampleApps/WpfCoreApp/LocationToVisibilityConverter.cs
Normal file
36
SampleApps/WpfCoreApp/LocationToVisibilityConverter.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using MapControl;
|
||||
|
||||
namespace WpfCoreApp
|
||||
{
|
||||
public class LocationToVisibilityConverter : IMultiValueConverter
|
||||
{
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var visibility = Visibility.Hidden;
|
||||
|
||||
if (values.Length == 2 && values[0] is MapBase && values[1] is Point?)
|
||||
{
|
||||
var parentMap = (MapBase)values[0];
|
||||
var position = (Point?)values[1];
|
||||
|
||||
if (position.HasValue &&
|
||||
position.Value.X >= 0d && position.Value.X <= parentMap.ActualWidth &&
|
||||
position.Value.Y >= 0d && position.Value.Y <= parentMap.ActualHeight)
|
||||
{
|
||||
visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
return visibility;
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue