mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-09 16:35:08 +00:00
First commit of the new XAML Map Control that replaces WPF Map Control, and now supports all three XAML platforms, WPF, Silverlight and WinRT.
This commit is contained in:
parent
c28e9d73d9
commit
27a302a5b8
124 changed files with 6938 additions and 2093 deletions
36
SampleApps/WpfApplication/LocationToVisibilityConverter.cs
Normal file
36
SampleApps/WpfApplication/LocationToVisibilityConverter.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using MapControl;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace WpfApplication
|
||||
{
|
||||
public class LocationToVisibilityConverter : IMultiValueConverter
|
||||
{
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
Visibility visibility = Visibility.Hidden;
|
||||
|
||||
if (values.Length == 2 && values[0] is Map && values[1] is Transform)
|
||||
{
|
||||
Map parentMap = (Map)values[0];
|
||||
Matrix 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue