mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-04 14:08:32 +00:00
Removed LocationPath property from MapItem and PushPin.
This commit is contained in:
parent
b0ecd850a2
commit
d0d949c9be
17 changed files with 88 additions and 133 deletions
|
|
@ -37,7 +37,7 @@
|
|||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="PointItemStyle" TargetType="map:MapItem">
|
||||
<Setter Property="LocationPath" Value="Location"/>
|
||||
<Setter Property="map:MapPanel.Location" Value="{Binding Location}"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||
<Setter Property="Template">
|
||||
|
|
@ -83,12 +83,12 @@
|
|||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="PushpinItemStyle" TargetType="map:MapItem">
|
||||
<Setter Property="LocationPath" Value="Location"/>
|
||||
<Setter Property="map:MapPanel.Location" Value="{Binding Location}"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<ControlTemplate TargetType="map:MapItem">
|
||||
<map:Pushpin Content="{Binding Name}"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
|
|
|
|||
36
SampleApps/StoreApplication/BindingHelper.cs
Normal file
36
SampleApps/StoreApplication/BindingHelper.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using MapControl;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
namespace StoreApplication
|
||||
{
|
||||
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) });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="PointItemStyle" TargetType="map:MapItem">
|
||||
<Setter Property="LocationPath" Value="Location"/>
|
||||
<Setter Property="local:BindingHelper.LocationPath" Value="Location"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
|
|
@ -82,13 +82,13 @@
|
|||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="PushpinItemStyle" TargetType="map:MapItem">
|
||||
<Setter Property="LocationPath" Value="Location"/>
|
||||
<Setter Property="local:BindingHelper.LocationPath" Value="Location"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<ControlTemplate TargetType="map:MapItem">
|
||||
<map:Pushpin Content="{Binding Name}"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
|
|
@ -122,7 +122,8 @@
|
|||
<map:MapItemsControl ItemsSource="{StaticResource Pushpins}"
|
||||
ItemContainerStyle="{StaticResource PushpinItemStyle}"/>
|
||||
|
||||
<!--<map:Pushpin map:MapPanel.Location="53.5,8.2" Background="Yellow" Foreground="Blue" Content="N 53° 30' E 8° 12'"/>-->
|
||||
<!-- No TypeConverter (yet?) for string to Location
|
||||
<map:Pushpin map:MapPanel.Location="53.5,8.2" Background="Yellow" Foreground="Blue" Content="N 53° 30' E 8° 12'"/>-->
|
||||
|
||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="4" FontSize="10"
|
||||
Text="{Binding TileLayer.Description, ElementName=map}"/>
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@
|
|||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BindingHelper.cs" />
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@
|
|||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<ControlTemplate TargetType="map:MapItem">
|
||||
<map:Pushpin Content="{Binding Name}"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue