mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
DependencyPropertyHelper
This commit is contained in:
parent
8e82e0bcbd
commit
bc12b388de
|
|
@ -11,9 +11,9 @@ namespace MapControl
|
|||
public static StyledProperty<TValue> Register<TOwner, TValue>(
|
||||
string name,
|
||||
TValue defaultValue = default,
|
||||
bool bindTwoWayByDefault = false,
|
||||
Action<TOwner, TValue, TValue> changed = null,
|
||||
Func<TOwner, TValue, TValue> coerce = null)
|
||||
Func<TOwner, TValue, TValue> coerce = null,
|
||||
bool bindTwoWayByDefault = false)
|
||||
where TOwner : AvaloniaObject
|
||||
{
|
||||
var property = AvaloniaProperty.Register<TOwner, TValue>(name, defaultValue, false,
|
||||
|
|
|
|||
|
|
@ -18,44 +18,50 @@ namespace MapControl
|
|||
DependencyPropertyHelper.Register<MapBase, Easing>(nameof(AnimationEasing), new QuadraticEaseOut());
|
||||
|
||||
public static readonly StyledProperty<Location> CenterProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, Location>(nameof(Center), new Location(), true,
|
||||
DependencyPropertyHelper.Register<MapBase, Location>(nameof(Center), new Location(),
|
||||
(map, oldValue, newValue) => map.CenterPropertyChanged(newValue),
|
||||
(map, value) => map.CoerceCenterProperty(value));
|
||||
(map, value) => map.CoerceCenterProperty(value),
|
||||
true);
|
||||
|
||||
public static readonly StyledProperty<Location> TargetCenterProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, Location>(nameof(TargetCenter), new Location(), true,
|
||||
DependencyPropertyHelper.Register<MapBase, Location>(nameof(TargetCenter), new Location(),
|
||||
async (map, oldValue, newValue) => await map.TargetCenterPropertyChanged(newValue),
|
||||
(map, value) => map.CoerceCenterProperty(value));
|
||||
(map, value) => map.CoerceCenterProperty(value),
|
||||
true);
|
||||
|
||||
public static readonly StyledProperty<double> MinZoomLevelProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(MinZoomLevel), 1d, false,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(MinZoomLevel), 1d,
|
||||
(map, oldValue, newValue) => map.MinZoomLevelPropertyChanged(newValue),
|
||||
(map, value) => map.CoerceMinZoomLevelProperty(value));
|
||||
|
||||
public static readonly StyledProperty<double> MaxZoomLevelProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(MaxZoomLevel), 20d, false,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(MaxZoomLevel), 20d,
|
||||
(map, oldValue, newValue) => map.MaxZoomLevelPropertyChanged(newValue),
|
||||
(map, value) => map.CoerceMaxZoomLevelProperty(value));
|
||||
|
||||
public static readonly StyledProperty<double> ZoomLevelProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(ZoomLevel), 1d, true,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(ZoomLevel), 1d,
|
||||
(map, oldValue, newValue) => map.ZoomLevelPropertyChanged(newValue),
|
||||
(map, value) => map.CoerceZoomLevelProperty(value));
|
||||
(map, value) => map.CoerceZoomLevelProperty(value),
|
||||
true);
|
||||
|
||||
public static readonly StyledProperty<double> TargetZoomLevelProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(TargetZoomLevel), 1d, true,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(TargetZoomLevel), 1d,
|
||||
async (map, oldValue, newValue) => await map.TargetZoomLevelPropertyChanged(newValue),
|
||||
(map, value) => map.CoerceZoomLevelProperty(value));
|
||||
(map, value) => map.CoerceZoomLevelProperty(value),
|
||||
true);
|
||||
|
||||
public static readonly StyledProperty<double> HeadingProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(Heading), 0d, true,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(Heading), 0d,
|
||||
(map, oldValue, newValue) => map.HeadingPropertyChanged(newValue),
|
||||
(map, value) => map.CoerceHeadingProperty(value));
|
||||
(map, value) => map.CoerceHeadingProperty(value),
|
||||
true);
|
||||
|
||||
public static readonly StyledProperty<double> TargetHeadingProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(TargetHeading), 0d, true,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(TargetHeading), 0d,
|
||||
async (map, oldValue, newValue) => await map.TargetHeadingPropertyChanged(newValue),
|
||||
(map, value) => map.CoerceHeadingProperty(value));
|
||||
(map, value) => map.CoerceHeadingProperty(value),
|
||||
true);
|
||||
|
||||
public static readonly DirectProperty<MapBase, double> ViewScaleProperty =
|
||||
AvaloniaProperty.RegisterDirect<MapBase, double>(nameof(ViewScale), map => map.ViewTransform.Scale);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace MapControl
|
|||
private static string QueryString(ushort tag) => $"/ifd/{{ushort={tag}}}";
|
||||
|
||||
public static readonly DependencyProperty SourcePathProperty =
|
||||
DependencyPropertyHelper.Register<GeoImage, string>(nameof(SourcePath), null, false,
|
||||
DependencyPropertyHelper.Register<GeoImage, string>(nameof(SourcePath), null,
|
||||
async (image, oldValue, newValue) => await image.SourcePathPropertyChanged(newValue));
|
||||
|
||||
public GeoImage()
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace MapControl
|
|||
}
|
||||
|
||||
public static readonly DependencyProperty SourcePathProperty =
|
||||
DependencyPropertyHelper.Register<GroundOverlay, string>(nameof(SourcePath), null, false,
|
||||
DependencyPropertyHelper.Register<GroundOverlay, string>(nameof(SourcePath), null,
|
||||
async (overlay, oldValue, newValue) => await overlay.SourcePathPropertyChanged(newValue));
|
||||
|
||||
public string SourcePath
|
||||
|
|
|
|||
|
|
@ -46,15 +46,15 @@ namespace MapControl
|
|||
DependencyPropertyHelper.Register<MapBase, TimeSpan>(nameof(AnimationDuration), TimeSpan.FromSeconds(0.3));
|
||||
|
||||
public static readonly DependencyProperty MapLayerProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, UIElement>(nameof(MapLayer), null, false,
|
||||
DependencyPropertyHelper.Register<MapBase, UIElement>(nameof(MapLayer), null,
|
||||
(map, oldValue, newValue) => map.MapLayerPropertyChanged(oldValue, newValue));
|
||||
|
||||
public static readonly DependencyProperty MapProjectionProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, MapProjection>(nameof(MapProjection), new WebMercatorProjection(), false,
|
||||
DependencyPropertyHelper.Register<MapBase, MapProjection>(nameof(MapProjection), new WebMercatorProjection(),
|
||||
(map, oldValue, newValue) => map.MapProjectionPropertyChanged(newValue));
|
||||
|
||||
public static readonly DependencyProperty ProjectionCenterProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, Location>(nameof(ProjectionCenter), null, false,
|
||||
DependencyPropertyHelper.Register<MapBase, Location>(nameof(ProjectionCenter), null,
|
||||
(map, oldValue, newValue) => map.ProjectionCenterPropertyChanged());
|
||||
|
||||
private Location transformCenter;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace MapControl
|
|||
|
||||
public static readonly DependencyProperty UpdateIntervalProperty =
|
||||
DependencyPropertyHelper.Register<MapImageLayer, TimeSpan>(nameof(UpdateInterval), TimeSpan.FromSeconds(0.2),
|
||||
false, (layer, oldValue, newValue) => layer.updateTimer.Interval = newValue);
|
||||
(layer, oldValue, newValue) => layer.updateTimer.Interval = newValue);
|
||||
|
||||
public static readonly DependencyProperty UpdateWhileViewportChangingProperty =
|
||||
DependencyPropertyHelper.Register<MapImageLayer, bool>(nameof(UpdateWhileViewportChanging));
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace MapControl
|
|||
public partial class MapPath : IMapElement
|
||||
{
|
||||
public static readonly DependencyProperty LocationProperty =
|
||||
DependencyPropertyHelper.Register<MapPath, Location>(nameof(Location), null, false,
|
||||
DependencyPropertyHelper.Register<MapPath, Location>(nameof(Location), null,
|
||||
(path, oldValue, newValue) => path.UpdateData());
|
||||
|
||||
private MapBase parentMap;
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ namespace MapControl
|
|||
public class MapPolygon : MapPath
|
||||
{
|
||||
public static readonly DependencyProperty LocationsProperty =
|
||||
DependencyPropertyHelper.Register<MapPolygon, IEnumerable<Location>>(nameof(Locations), null, false,
|
||||
DependencyPropertyHelper.Register<MapPolygon, IEnumerable<Location>>(nameof(Locations), null,
|
||||
(polygon, oldValue, newValue) => polygon.DataCollectionPropertyChanged(oldValue, newValue));
|
||||
|
||||
public static readonly DependencyProperty FillRuleProperty =
|
||||
DependencyPropertyHelper.Register<MapPolygon, FillRule>(nameof(FillRule), FillRule.EvenOdd, false,
|
||||
DependencyPropertyHelper.Register<MapPolygon, FillRule>(nameof(FillRule), FillRule.EvenOdd,
|
||||
(polygon, oldValue, newValue) => ((PathGeometry)polygon.Data).FillRule = newValue);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ namespace MapControl
|
|||
public class MapPolyline : MapPath
|
||||
{
|
||||
public static readonly DependencyProperty LocationsProperty =
|
||||
DependencyPropertyHelper.Register<MapPolyline, IEnumerable<Location>>(nameof(Locations), null, false,
|
||||
DependencyPropertyHelper.Register<MapPolyline, IEnumerable<Location>>(nameof(Locations), null,
|
||||
(polyline, oldValue, newValue) => polyline.DataCollectionPropertyChanged(oldValue, newValue));
|
||||
|
||||
public static readonly DependencyProperty FillRuleProperty =
|
||||
DependencyPropertyHelper.Register<MapPolyline, FillRule>(nameof(FillRule), FillRule.EvenOdd, false,
|
||||
DependencyPropertyHelper.Register<MapPolyline, FillRule>(nameof(FillRule), FillRule.EvenOdd,
|
||||
(polyline, oldValue, newValue) => ((PathGeometry)polyline.Data).FillRule = newValue);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace MapControl
|
|||
public abstract partial class MapTileLayerBase : Panel, IMapLayer
|
||||
{
|
||||
public static readonly DependencyProperty TileSourceProperty =
|
||||
DependencyPropertyHelper.Register<MapTileLayerBase, TileSource>(nameof(TileSource), null, false,
|
||||
DependencyPropertyHelper.Register<MapTileLayerBase, TileSource>(nameof(TileSource), null,
|
||||
async (layer, oldValue, newValue) => await layer.Update(true));
|
||||
|
||||
public static readonly DependencyProperty SourceNameProperty =
|
||||
|
|
|
|||
|
|
@ -30,11 +30,15 @@ namespace MapControl
|
|||
public partial class WmsImageLayer : MapImageLayer
|
||||
{
|
||||
public static readonly DependencyProperty ServiceUriProperty =
|
||||
DependencyPropertyHelper.Register<WmsImageLayer, Uri>(nameof(ServiceUri), null, false,
|
||||
DependencyPropertyHelper.Register<WmsImageLayer, Uri>(nameof(ServiceUri), null,
|
||||
async (layer, oldValue, newValue) => await layer.UpdateImageAsync());
|
||||
|
||||
public static readonly DependencyProperty WmsStylesProperty =
|
||||
DependencyPropertyHelper.Register<WmsImageLayer, string>(nameof(WmsStyles), string.Empty,
|
||||
async (layer, oldValue, newValue) => await layer.UpdateImageAsync());
|
||||
|
||||
public static readonly DependencyProperty WmsLayersProperty =
|
||||
DependencyPropertyHelper.Register<WmsImageLayer, string>(nameof(WmsLayers), null, false,
|
||||
DependencyPropertyHelper.Register<WmsImageLayer, string>(nameof(WmsLayers), null,
|
||||
async (layer, oldValue, newValue) =>
|
||||
{
|
||||
// Ignore property change from GetImageAsync when Layers was null.
|
||||
|
|
@ -45,10 +49,6 @@ namespace MapControl
|
|||
}
|
||||
});
|
||||
|
||||
public static readonly DependencyProperty WmsStylesProperty =
|
||||
DependencyPropertyHelper.Register<WmsImageLayer, string>(nameof(WmsStyles), string.Empty, false,
|
||||
async (layer, oldValue, newValue) => await layer.UpdateImageAsync());
|
||||
|
||||
/// <summary>
|
||||
/// The base request URL.
|
||||
/// </summary>
|
||||
|
|
@ -58,15 +58,6 @@ namespace MapControl
|
|||
set => SetValue(ServiceUriProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Comma-separated sequence of WMS Layer names to be displayed. If not set, the first Layer is displayed.
|
||||
/// </summary>
|
||||
public string WmsLayers
|
||||
{
|
||||
get => (string)GetValue(WmsLayersProperty);
|
||||
set => SetValue(WmsLayersProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Comma-separated sequence of requested WMS Styles. Default is an empty string.
|
||||
/// </summary>
|
||||
|
|
@ -76,6 +67,15 @@ namespace MapControl
|
|||
set => SetValue(WmsStylesProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Comma-separated sequence of WMS Layer names to be displayed. If not set, the first Layer is displayed.
|
||||
/// </summary>
|
||||
public string WmsLayers
|
||||
{
|
||||
get => (string)GetValue(WmsLayersProperty);
|
||||
set => SetValue(WmsLayersProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of all layer names returned by a GetCapabilities response.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace MapControl
|
|||
public class WmtsTileLayer : MapTileLayerBase
|
||||
{
|
||||
public static readonly DependencyProperty CapabilitiesUriProperty =
|
||||
DependencyPropertyHelper.Register<WmtsTileLayer, Uri>(nameof(CapabilitiesUri), null, false,
|
||||
DependencyPropertyHelper.Register<WmtsTileLayer, Uri>(nameof(CapabilitiesUri), null,
|
||||
(layer, oldValue, newValue) => layer.TileMatrixSets.Clear());
|
||||
|
||||
public static readonly DependencyProperty LayerProperty =
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ namespace MapControl
|
|||
public static DependencyProperty Register<TOwner, TValue>(
|
||||
string name,
|
||||
TValue defaultValue = default,
|
||||
bool bindTwoWayByDefault = false,
|
||||
Action<TOwner, TValue, TValue> changed = null,
|
||||
Func<TOwner, TValue, TValue> coerce = null)
|
||||
Func<TOwner, TValue, TValue> coerce = null,
|
||||
bool bindTwoWayByDefault = false)
|
||||
where TOwner : DependencyObject
|
||||
{
|
||||
var metadata = new FrameworkPropertyMetadata
|
||||
|
|
|
|||
|
|
@ -14,44 +14,50 @@ namespace MapControl
|
|||
new QuadraticEase { EasingMode = EasingMode.EaseOut });
|
||||
|
||||
public static readonly DependencyProperty CenterProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, Location>(nameof(Center), new Location(), true,
|
||||
DependencyPropertyHelper.Register<MapBase, Location>(nameof(Center), new Location(),
|
||||
(map, oldValue, newValue) => map.CenterPropertyChanged(newValue),
|
||||
(map, value) => map.CoerceCenterProperty(value));
|
||||
(map, value) => map.CoerceCenterProperty(value),
|
||||
true);
|
||||
|
||||
public static readonly DependencyProperty TargetCenterProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, Location>(nameof(TargetCenter), new Location(), true,
|
||||
DependencyPropertyHelper.Register<MapBase, Location>(nameof(TargetCenter), new Location(),
|
||||
(map, oldValue, newValue) => map.TargetCenterPropertyChanged(newValue),
|
||||
(map, value) => map.CoerceCenterProperty(value));
|
||||
(map, value) => map.CoerceCenterProperty(value),
|
||||
true);
|
||||
|
||||
public static readonly DependencyProperty MinZoomLevelProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(MinZoomLevel), 1d, false,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(MinZoomLevel), 1d,
|
||||
(map, oldValue, newValue) => map.MinZoomLevelPropertyChanged(newValue),
|
||||
(map, value) => map.CoerceMinZoomLevelProperty(value));
|
||||
|
||||
public static readonly DependencyProperty MaxZoomLevelProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(MaxZoomLevel), 20d, false,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(MaxZoomLevel), 20d,
|
||||
(map, oldValue, newValue) => map.MaxZoomLevelPropertyChanged(newValue),
|
||||
(map, value) => map.CoerceMaxZoomLevelProperty(value));
|
||||
|
||||
public static readonly DependencyProperty ZoomLevelProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(ZoomLevel), 1d, true,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(ZoomLevel), 1d,
|
||||
(map, oldValue, newValue) => map.ZoomLevelPropertyChanged(newValue),
|
||||
(map, value) => map.CoerceZoomLevelProperty(value));
|
||||
(map, value) => map.CoerceZoomLevelProperty(value),
|
||||
true);
|
||||
|
||||
public static readonly DependencyProperty TargetZoomLevelProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(TargetZoomLevel), 1d, true,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(TargetZoomLevel), 1d,
|
||||
(map, oldValue, newValue) => map.TargetZoomLevelPropertyChanged(newValue),
|
||||
(map, value) => map.CoerceZoomLevelProperty(value));
|
||||
(map, value) => map.CoerceZoomLevelProperty(value),
|
||||
true);
|
||||
|
||||
public static readonly DependencyProperty HeadingProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(Heading), 0d, true,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(Heading), 0d,
|
||||
(map, oldValue, newValue) => map.HeadingPropertyChanged(newValue),
|
||||
(map, value) => map.CoerceHeadingProperty(value));
|
||||
(map, value) => map.CoerceHeadingProperty(value),
|
||||
true);
|
||||
|
||||
public static readonly DependencyProperty TargetHeadingProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(TargetHeading), 0d, true,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(TargetHeading), 0d,
|
||||
(map, oldValue, newValue) => map.TargetHeadingPropertyChanged(newValue),
|
||||
(map, value) => map.CoerceHeadingProperty(value));
|
||||
(map, value) => map.CoerceHeadingProperty(value),
|
||||
true);
|
||||
|
||||
private static readonly DependencyPropertyKey ViewScalePropertyKey =
|
||||
DependencyPropertyHelper.RegisterReadOnly<MapBase, double>(nameof(ViewScale), 0d);
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ namespace MapControl
|
|||
public class MapMultiPolygon : MapPath
|
||||
{
|
||||
public static readonly DependencyProperty PolygonsProperty =
|
||||
DependencyPropertyHelper.Register<MapMultiPolygon, IEnumerable<IEnumerable<Location>>>(nameof(Polygons), null, false,
|
||||
DependencyPropertyHelper.Register<MapMultiPolygon, IEnumerable<IEnumerable<Location>>>(nameof(Polygons), null,
|
||||
(polygon, oldValue, newValue) => polygon.DataCollectionPropertyChanged(oldValue, newValue));
|
||||
|
||||
public static readonly DependencyProperty FillRuleProperty =
|
||||
DependencyPropertyHelper.Register<MapMultiPolygon, FillRule>(nameof(FillRule), FillRule.EvenOdd, false,
|
||||
DependencyPropertyHelper.Register<MapMultiPolygon, FillRule>(nameof(FillRule), FillRule.EvenOdd,
|
||||
(polygon, oldValue, newValue) => ((PathGeometry)polygon.Data).FillRule = newValue);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ namespace MapControl
|
|||
public static DependencyProperty Register<TOwner, TValue>(
|
||||
string name,
|
||||
TValue defaultValue = default,
|
||||
bool bindTwoWayByDefault = false, // unused in WinUI/UWP
|
||||
Action<TOwner, TValue, TValue> changed = null)
|
||||
where TOwner : DependencyObject
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,43 +23,43 @@ namespace MapControl
|
|||
new QuadraticEase { EasingMode = EasingMode.EaseOut });
|
||||
|
||||
public static readonly DependencyProperty CenterProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, Location>(nameof(Center), new Location(), true,
|
||||
DependencyPropertyHelper.Register<MapBase, Location>(nameof(Center), new Location(),
|
||||
(map, oldValue, newValue) => map.CenterPropertyChanged(newValue));
|
||||
|
||||
public static readonly DependencyProperty TargetCenterProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, Location>(nameof(TargetCenter), new Location(), true,
|
||||
DependencyPropertyHelper.Register<MapBase, Location>(nameof(TargetCenter), new Location(),
|
||||
(map, oldValue, newValue) => map.TargetCenterPropertyChanged(newValue));
|
||||
|
||||
public static readonly DependencyProperty MinZoomLevelProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(MinZoomLevel), 1d, false,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(MinZoomLevel), 1d,
|
||||
(map, oldValue, newValue) => map.MinZoomLevelPropertyChanged(newValue));
|
||||
|
||||
public static readonly DependencyProperty MaxZoomLevelProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(MaxZoomLevel), 20d, false,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(MaxZoomLevel), 20d,
|
||||
(map, oldValue, newValue) => map.MaxZoomLevelPropertyChanged(newValue));
|
||||
|
||||
public static readonly DependencyProperty ZoomLevelProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(ZoomLevel), 1d, true,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(ZoomLevel), 1d,
|
||||
(map, oldValue, newValue) => map.ZoomLevelPropertyChanged(newValue));
|
||||
|
||||
public static readonly DependencyProperty TargetZoomLevelProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(TargetZoomLevel), 1d, true,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(TargetZoomLevel), 1d,
|
||||
(map, oldValue, newValue) => map.TargetZoomLevelPropertyChanged(newValue));
|
||||
|
||||
public static readonly DependencyProperty HeadingProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(Heading), 0d, true,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(Heading), 0d,
|
||||
(map, oldValue, newValue) => map.HeadingPropertyChanged(newValue));
|
||||
|
||||
public static readonly DependencyProperty TargetHeadingProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(TargetHeading), 0d, true,
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(TargetHeading), 0d,
|
||||
(map, oldValue, newValue) => map.TargetHeadingPropertyChanged(newValue));
|
||||
|
||||
public static readonly DependencyProperty ViewScaleProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, double>(nameof(ViewScale), 0d);
|
||||
|
||||
private static readonly DependencyProperty AnimatedCenterProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, Windows.Foundation.Point>(nameof(AnimatedCenter),
|
||||
new Windows.Foundation.Point(), false, (map, oldValue, newValue) => map.Center = new Location(newValue.Y, newValue.X));
|
||||
DependencyPropertyHelper.Register<MapBase, Windows.Foundation.Point>(nameof(AnimatedCenter), new Windows.Foundation.Point(),
|
||||
(map, oldValue, newValue) => map.Center = new Location(newValue.Y, newValue.X));
|
||||
|
||||
private Windows.Foundation.Point AnimatedCenter => (Windows.Foundation.Point)GetValue(AnimatedCenterProperty);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ namespace MapControl
|
|||
public class MapContentControl : ContentControl
|
||||
{
|
||||
public static readonly DependencyProperty AutoCollapseProperty =
|
||||
DependencyPropertyHelper.Register<MapContentControl, bool>(nameof(AutoCollapse), false, false,
|
||||
DependencyPropertyHelper.Register<MapContentControl, bool>(nameof(AutoCollapse), false,
|
||||
(control, oldValue, newValue) => MapPanel.SetAutoCollapse(control, newValue));
|
||||
|
||||
public static readonly DependencyProperty LocationProperty =
|
||||
DependencyPropertyHelper.Register<MapContentControl, Location>(nameof(Location), null, false,
|
||||
DependencyPropertyHelper.Register<MapContentControl, Location>(nameof(Location), null,
|
||||
(control, oldValue, newValue) => MapPanel.SetLocation(control, newValue));
|
||||
|
||||
public MapContentControl()
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ namespace MapControl
|
|||
public partial class MapItem
|
||||
{
|
||||
public static readonly DependencyProperty AutoCollapseProperty =
|
||||
DependencyPropertyHelper.Register<MapItem, bool>(nameof(AutoCollapse), false, false,
|
||||
DependencyPropertyHelper.Register<MapItem, bool>(nameof(AutoCollapse), false,
|
||||
(item, oldValue, newValue) => MapPanel.SetAutoCollapse(item, newValue));
|
||||
|
||||
public static readonly DependencyProperty LocationProperty =
|
||||
DependencyPropertyHelper.Register<MapItem, Location>(nameof(Location), null, false,
|
||||
DependencyPropertyHelper.Register<MapItem, Location>(nameof(Location), null,
|
||||
(item, oldValue, newValue) => item.LocationPropertyChanged(newValue));
|
||||
|
||||
private void LocationPropertyChanged(Location location)
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ namespace MapControl
|
|||
public partial class PushpinBorder : UserControl
|
||||
{
|
||||
public static readonly DependencyProperty ArrowSizeProperty =
|
||||
DependencyPropertyHelper.Register<PushpinBorder, Size>(nameof(ArrowSize), new Size(10d, 20d), false,
|
||||
DependencyPropertyHelper.Register<PushpinBorder, Size>(nameof(ArrowSize), new Size(10d, 20d),
|
||||
(border, oldValue, newValue) => border.SetBorderMargin());
|
||||
|
||||
public static readonly DependencyProperty BorderWidthProperty =
|
||||
DependencyPropertyHelper.Register<PushpinBorder, double>(nameof(BorderWidth), 0d, false,
|
||||
DependencyPropertyHelper.Register<PushpinBorder, double>(nameof(BorderWidth), 0d,
|
||||
(border, oldValue, newValue) => border.SetBorderMargin());
|
||||
|
||||
private readonly Border border = new Border();
|
||||
|
|
|
|||
Loading…
Reference in a new issue