mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
using System.Windows.Media;
|
|
using MapControl;
|
|
|
|
namespace WpfApplication
|
|
{
|
|
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 Map && values[1] is Transform)
|
|
{
|
|
var parentMap = (Map)values[0];
|
|
var transform = ((Transform)values[1]).Value;
|
|
|
|
if (transform.OffsetX >= 0d && transform.OffsetX <= parentMap.ActualWidth &&
|
|
transform.OffsetY >= 0d && transform.OffsetY <= parentMap.ActualHeight)
|
|
{
|
|
visibility = Visibility.Visible;
|
|
}
|
|
}
|
|
|
|
return visibility;
|
|
}
|
|
|
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
}
|
|
}
|