2012-08-26 21:54:00 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
|
using MapControl;
|
|
|
|
|
|
|
|
|
|
|
|
namespace SampleApplication
|
|
|
|
|
|
{
|
|
|
|
|
|
public class ViewportPositionToVisibilityConverter : IMultiValueConverter
|
|
|
|
|
|
{
|
|
|
|
|
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
|
{
|
2012-10-25 08:42:51 +02:00
|
|
|
|
Visibility visibility = Visibility.Hidden;
|
2012-08-26 21:54:00 +02:00
|
|
|
|
|
|
|
|
|
|
if (values.Length == 2 && values[0] is Map && values[1] is Point? && ((Point?)values[1]).HasValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
Map parentMap = (Map)values[0];
|
|
|
|
|
|
Point position = ((Point?)values[1]).Value;
|
|
|
|
|
|
|
2012-10-25 08:42:51 +02:00
|
|
|
|
if (position.X >= 0d && position.X <= parentMap.ActualWidth &&
|
|
|
|
|
|
position.Y >= 0d && position.Y <= parentMap.ActualHeight)
|
2012-08-26 21:54:00 +02:00
|
|
|
|
{
|
2012-10-25 08:42:51 +02:00
|
|
|
|
visibility = Visibility.Visible;
|
2012-08-26 21:54:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return visibility;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new NotSupportedException();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|