mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Added MapItem.Location and LocationMemberPath
This commit is contained in:
parent
22fc5085de
commit
0d7387059b
11 changed files with 59 additions and 68 deletions
|
|
@ -1,36 +0,0 @@
|
|||
using MapControl;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
namespace UniversalApp
|
||||
{
|
||||
public class BindingHelper
|
||||
{
|
||||
public static readonly DependencyProperty LocationPathProperty = DependencyProperty.RegisterAttached(
|
||||
"LocationPath", typeof(string), typeof(BindingHelper),
|
||||
new PropertyMetadata(null, LocationPathPropertyChanged));
|
||||
|
||||
public static string GetLocationPath(DependencyObject obj)
|
||||
{
|
||||
return (string)obj.GetValue(LocationPathProperty);
|
||||
}
|
||||
|
||||
public static void SetLocationPath(DependencyObject obj, string value)
|
||||
{
|
||||
obj.SetValue(LocationPathProperty, value);
|
||||
}
|
||||
|
||||
private static void LocationPathPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var propertyPath = e.NewValue as string;
|
||||
|
||||
if (propertyPath != null)
|
||||
{
|
||||
BindingOperations.SetBinding(
|
||||
obj,
|
||||
MapPanel.LocationProperty,
|
||||
new Binding { Path = new PropertyPath(propertyPath) });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
</Style>
|
||||
|
||||
<Style x:Key="PointItemStyle" TargetType="map:MapItem">
|
||||
<Setter Property="local:BindingHelper.LocationPath" Value="Location"/>
|
||||
<Setter Property="LocationMemberPath" Value="Location"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
</Style>
|
||||
|
||||
<Style x:Key="PushpinItemStyle" TargetType="map:MapItem">
|
||||
<Setter Property="local:BindingHelper.LocationPath" Value="Location"/>
|
||||
<Setter Property="LocationMemberPath" Value="Location"/>
|
||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
<Setter Property="Template">
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@
|
|||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BindingHelper.cs" />
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
<Style x:Key="PointItemStyle" TargetType="map:MapItem">
|
||||
<EventSetter Event="TouchDown" Handler="MapItemTouchDown"/>
|
||||
<Setter Property="map:MapPanel.Location" Value="{Binding Location}"/>
|
||||
<Setter Property="Location" Value="{Binding Location}"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
|
|
@ -80,7 +80,7 @@
|
|||
|
||||
<Style x:Key="PushpinItemStyle" TargetType="map:MapItem">
|
||||
<EventSetter Event="TouchDown" Handler="MapItemTouchDown"/>
|
||||
<Setter Property="map:MapPanel.Location" Value="{Binding Location}"/>
|
||||
<Setter Property="Location" Value="{Binding Location}"/>
|
||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
<Setter Property="Visibility">
|
||||
|
|
@ -123,7 +123,7 @@
|
|||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<map:Map x:Name="map" ZoomLevel="11" MaxZoomLevel="21"
|
||||
<map:Map x:Name="map" ZoomLevel="11" MaxZoomLevel="21" MouseWheelZoomDelta="0.5"
|
||||
Center="{Binding MapCenter}"
|
||||
MapLayer="{Binding MapLayers.CurrentMapLayer}"
|
||||
MapProjection="{Binding SelectedValue, ElementName=projectionComboBox,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue