Use expression bodies for properties

This commit is contained in:
Clemens 2022-08-06 10:40:59 +02:00
parent e8b37f03ff
commit 74ba508e26
33 changed files with 194 additions and 230 deletions

View file

@ -42,31 +42,31 @@ namespace MapControl
public double South
{
get { return south; }
set { south = Math.Min(Math.Max(value, -90d), 90d); }
get => south;
set => south = Math.Min(Math.Max(value, -90d), 90d);
}
public double North
{
get { return north; }
set { north = Math.Min(Math.Max(value, -90d), 90d); }
get => north;
set => north = Math.Min(Math.Max(value, -90d), 90d);
}
public virtual double Width
{
get { return East - West; }
get => East - West;
protected set { }
}
public virtual double Height
{
get { return North - South; }
get => North - South;
protected set { }
}
public virtual Location Center
{
get { return new Location((South + North) / 2d, (West + East) / 2d); }
get => new Location((South + North) / 2d, (West + East) / 2d);
protected set { }
}

View file

@ -41,8 +41,8 @@ namespace MapControl
public string SourcePath
{
get { return (string)GetValue(SourcePathProperty); }
set { SetValue(SourcePathProperty, value); }
get => (string)GetValue(SourcePathProperty);
set => SetValue(SourcePathProperty, value);
}
public GeoImage()

View file

@ -61,8 +61,8 @@ namespace MapControl
public string SourcePath
{
get { return (string)GetValue(SourcePathProperty); }
set { SetValue(SourcePathProperty, value); }
get => (string)GetValue(SourcePathProperty);
set => SetValue(SourcePathProperty, value);
}
private async Task SourcePathPropertyChanged(string sourcePath)

View file

@ -29,8 +29,8 @@ namespace MapControl
public double Latitude
{
get { return latitude; }
set { latitude = Math.Min(Math.Max(value, -90d), 90d); }
get => latitude;
set => latitude = Math.Min(Math.Max(value, -90d), 90d);
}
public double Longitude { get; set; }

View file

@ -85,8 +85,8 @@ namespace MapControl
/// </summary>
public Brush Foreground
{
get { return (Brush)GetValue(ForegroundProperty); }
set { SetValue(ForegroundProperty, value); }
get => (Brush)GetValue(ForegroundProperty);
set => SetValue(ForegroundProperty, value);
}
/// <summary>
@ -96,8 +96,8 @@ namespace MapControl
/// </summary>
public UIElement MapLayer
{
get { return (UIElement)GetValue(MapLayerProperty); }
set { SetValue(MapLayerProperty, value); }
get => (UIElement)GetValue(MapLayerProperty);
set => SetValue(MapLayerProperty, value);
}
/// <summary>
@ -105,8 +105,8 @@ namespace MapControl
/// </summary>
public MapProjection MapProjection
{
get { return (MapProjection)GetValue(MapProjectionProperty); }
set { SetValue(MapProjectionProperty, value); }
get => (MapProjection)GetValue(MapProjectionProperty);
set => SetValue(MapProjectionProperty, value);
}
/// <summary>
@ -115,8 +115,8 @@ namespace MapControl
/// </summary>
public Location ProjectionCenter
{
get { return (Location)GetValue(ProjectionCenterProperty); }
set { SetValue(ProjectionCenterProperty, value); }
get => (Location)GetValue(ProjectionCenterProperty);
set => SetValue(ProjectionCenterProperty, value);
}
/// <summary>
@ -124,8 +124,8 @@ namespace MapControl
/// </summary>
public Location Center
{
get { return (Location)GetValue(CenterProperty); }
set { SetValue(CenterProperty, value); }
get => (Location)GetValue(CenterProperty);
set => SetValue(CenterProperty, value);
}
/// <summary>
@ -133,8 +133,8 @@ namespace MapControl
/// </summary>
public Location TargetCenter
{
get { return (Location)GetValue(TargetCenterProperty); }
set { SetValue(TargetCenterProperty, value); }
get => (Location)GetValue(TargetCenterProperty);
set => SetValue(TargetCenterProperty, value);
}
/// <summary>
@ -144,8 +144,8 @@ namespace MapControl
/// </summary>
public double MinZoomLevel
{
get { return (double)GetValue(MinZoomLevelProperty); }
set { SetValue(MinZoomLevelProperty, value); }
get => (double)GetValue(MinZoomLevelProperty);
set => SetValue(MinZoomLevelProperty, value);
}
/// <summary>
@ -155,8 +155,8 @@ namespace MapControl
/// </summary>
public double MaxZoomLevel
{
get { return (double)GetValue(MaxZoomLevelProperty); }
set { SetValue(MaxZoomLevelProperty, value); }
get => (double)GetValue(MaxZoomLevelProperty);
set => SetValue(MaxZoomLevelProperty, value);
}
/// <summary>
@ -164,8 +164,8 @@ namespace MapControl
/// </summary>
public double ZoomLevel
{
get { return (double)GetValue(ZoomLevelProperty); }
set { SetValue(ZoomLevelProperty, value); }
get => (double)GetValue(ZoomLevelProperty);
set => SetValue(ZoomLevelProperty, value);
}
/// <summary>
@ -173,8 +173,8 @@ namespace MapControl
/// </summary>
public double TargetZoomLevel
{
get { return (double)GetValue(TargetZoomLevelProperty); }
set { SetValue(TargetZoomLevelProperty, value); }
get => (double)GetValue(TargetZoomLevelProperty);
set => SetValue(TargetZoomLevelProperty, value);
}
/// <summary>
@ -182,8 +182,8 @@ namespace MapControl
/// </summary>
public double Heading
{
get { return (double)GetValue(HeadingProperty); }
set { SetValue(HeadingProperty, value); }
get => (double)GetValue(HeadingProperty);
set => SetValue(HeadingProperty, value);
}
/// <summary>
@ -191,8 +191,8 @@ namespace MapControl
/// </summary>
public double TargetHeading
{
get { return (double)GetValue(TargetHeadingProperty); }
set { SetValue(TargetHeadingProperty, value); }
get => (double)GetValue(TargetHeadingProperty);
set => SetValue(TargetHeadingProperty, value);
}
/// <summary>
@ -201,8 +201,8 @@ namespace MapControl
/// </summary>
public TimeSpan AnimationDuration
{
get { return (TimeSpan)GetValue(AnimationDurationProperty); }
set { SetValue(AnimationDurationProperty, value); }
get => (TimeSpan)GetValue(AnimationDurationProperty);
set => SetValue(AnimationDurationProperty, value);
}
/// <summary>
@ -211,18 +211,15 @@ namespace MapControl
/// </summary>
public EasingFunctionBase AnimationEasingFunction
{
get { return (EasingFunctionBase)GetValue(AnimationEasingFunctionProperty); }
set { SetValue(AnimationEasingFunctionProperty, value); }
get => (EasingFunctionBase)GetValue(AnimationEasingFunctionProperty);
set => SetValue(AnimationEasingFunctionProperty, value);
}
/// <summary>
/// Gets the scaling factor from cartesian map coordinates to view coordinates,
/// i.e. pixels per meter, as a read-only dependency property.
/// </summary>
public double ViewScale
{
get { return (double)GetValue(ViewScaleProperty); }
}
public double ViewScale => (double)GetValue(ViewScaleProperty);
/// <summary>
/// Gets the ViewTransform instance that is used to transform between cartesian map coordinates

View file

@ -57,8 +57,8 @@ namespace MapControl
/// </summary>
public double MinLineDistance
{
get { return (double)GetValue(MinLineDistanceProperty); }
set { SetValue(MinLineDistanceProperty, value); }
get => (double)GetValue(MinLineDistanceProperty);
set => SetValue(MinLineDistanceProperty, value);
}
private void SetLineDistance()

View file

@ -74,8 +74,8 @@ namespace MapControl
/// </summary>
public string Description
{
get { return (string)GetValue(DescriptionProperty); }
set { SetValue(DescriptionProperty, value); }
get => (string)GetValue(DescriptionProperty);
set => SetValue(DescriptionProperty, value);
}
/// <summary>
@ -85,8 +85,8 @@ namespace MapControl
/// </summary>
public double RelativeImageSize
{
get { return (double)GetValue(RelativeImageSizeProperty); }
set { SetValue(RelativeImageSizeProperty, value); }
get => (double)GetValue(RelativeImageSizeProperty);
set => SetValue(RelativeImageSizeProperty, value);
}
/// <summary>
@ -94,8 +94,8 @@ namespace MapControl
/// </summary>
public TimeSpan UpdateInterval
{
get { return (TimeSpan)GetValue(UpdateIntervalProperty); }
set { SetValue(UpdateIntervalProperty, value); }
get => (TimeSpan)GetValue(UpdateIntervalProperty);
set => SetValue(UpdateIntervalProperty, value);
}
/// <summary>
@ -103,8 +103,8 @@ namespace MapControl
/// </summary>
public bool UpdateWhileViewportChanging
{
get { return (bool)GetValue(UpdateWhileViewportChangingProperty); }
set { SetValue(UpdateWhileViewportChangingProperty, value); }
get => (bool)GetValue(UpdateWhileViewportChangingProperty);
set => SetValue(UpdateWhileViewportChangingProperty, value);
}
/// <summary>
@ -112,8 +112,8 @@ namespace MapControl
/// </summary>
public Brush MapBackground
{
get { return (Brush)GetValue(MapBackgroundProperty); }
set { SetValue(MapBackgroundProperty, value); }
get => (Brush)GetValue(MapBackgroundProperty);
set => SetValue(MapBackgroundProperty, value);
}
/// <summary>
@ -121,8 +121,8 @@ namespace MapControl
/// </summary>
public Brush MapForeground
{
get { return (Brush)GetValue(MapForegroundProperty); }
set { SetValue(MapForegroundProperty, value); }
get => (Brush)GetValue(MapForegroundProperty);
set => SetValue(MapForegroundProperty, value);
}
/// <summary>
@ -130,8 +130,8 @@ namespace MapControl
/// </summary>
public double LoadingProgress
{
get { return (double)GetValue(LoadingProgressProperty); }
private set { SetValue(LoadingProgressProperty, value); }
get => (double)GetValue(LoadingProgressProperty);
private set => SetValue(LoadingProgressProperty, value);
}
/// <summary>

View file

@ -36,8 +36,8 @@ namespace MapControl
/// </summary>
public bool AutoCollapse
{
get { return (bool)GetValue(AutoCollapseProperty); }
set { SetValue(AutoCollapseProperty, value); }
get => (bool)GetValue(AutoCollapseProperty);
set => SetValue(AutoCollapseProperty, value);
}
/// <summary>
@ -45,8 +45,8 @@ namespace MapControl
/// </summary>
public Location Location
{
get { return (Location)GetValue(LocationProperty); }
set { SetValue(LocationProperty, value); }
get => (Location)GetValue(LocationProperty);
set => SetValue(LocationProperty, value);
}
/// <summary>
@ -54,8 +54,8 @@ namespace MapControl
/// </summary>
public string LocationMemberPath
{
get { return (string)GetValue(LocationMemberPathProperty); }
set { SetValue(LocationMemberPathProperty, value); }
get => (string)GetValue(LocationMemberPathProperty);
set => SetValue(LocationMemberPathProperty, value);
}
}

View file

@ -22,92 +22,92 @@ namespace MapControl
{
public FontFamily FontFamily
{
get { return (FontFamily)GetValue(FontFamilyProperty); }
set { SetValue(FontFamilyProperty, value); }
get => (FontFamily)GetValue(FontFamilyProperty);
set => SetValue(FontFamilyProperty, value);
}
public double FontSize
{
get { return (double)GetValue(FontSizeProperty); }
set { SetValue(FontSizeProperty, value); }
get => (double)GetValue(FontSizeProperty);
set => SetValue(FontSizeProperty, value);
}
public FontStyle FontStyle
{
get { return (FontStyle)GetValue(FontStyleProperty); }
set { SetValue(FontStyleProperty, value); }
get => (FontStyle)GetValue(FontStyleProperty);
set => SetValue(FontStyleProperty, value);
}
public FontStretch FontStretch
{
get { return (FontStretch)GetValue(FontStretchProperty); }
set { SetValue(FontStretchProperty, value); }
get => (FontStretch)GetValue(FontStretchProperty);
set => SetValue(FontStretchProperty, value);
}
public FontWeight FontWeight
{
get { return (FontWeight)GetValue(FontWeightProperty); }
set { SetValue(FontWeightProperty, value); }
get => (FontWeight)GetValue(FontWeightProperty);
set => SetValue(FontWeightProperty, value);
}
public Brush Foreground
{
get { return (Brush)GetValue(ForegroundProperty); }
set { SetValue(ForegroundProperty, value); }
get => (Brush)GetValue(ForegroundProperty);
set => SetValue(ForegroundProperty, value);
}
public Brush Stroke
{
get { return (Brush)GetValue(StrokeProperty); }
set { SetValue(StrokeProperty, value); }
get => (Brush)GetValue(StrokeProperty);
set => SetValue(StrokeProperty, value);
}
public double StrokeThickness
{
get { return (double)GetValue(StrokeThicknessProperty); }
set { SetValue(StrokeThicknessProperty, value); }
get => (double)GetValue(StrokeThicknessProperty);
set => SetValue(StrokeThicknessProperty, value);
}
public DoubleCollection StrokeDashArray
{
get { return (DoubleCollection)GetValue(StrokeDashArrayProperty); }
set { SetValue(StrokeDashArrayProperty, value); }
get => (DoubleCollection)GetValue(StrokeDashArrayProperty);
set => SetValue(StrokeDashArrayProperty, value);
}
public double StrokeDashOffset
{
get { return (double)GetValue(StrokeDashOffsetProperty); }
set { SetValue(StrokeDashOffsetProperty, value); }
get => (double)GetValue(StrokeDashOffsetProperty);
set => SetValue(StrokeDashOffsetProperty, value);
}
public PenLineCap StrokeDashCap
{
get { return (PenLineCap)GetValue(StrokeDashCapProperty); }
set { SetValue(StrokeDashCapProperty, value); }
get => (PenLineCap)GetValue(StrokeDashCapProperty);
set => SetValue(StrokeDashCapProperty, value);
}
public PenLineCap StrokeStartLineCap
{
get { return (PenLineCap)GetValue(StrokeStartLineCapProperty); }
set { SetValue(StrokeStartLineCapProperty, value); }
get => (PenLineCap)GetValue(StrokeStartLineCapProperty);
set => SetValue(StrokeStartLineCapProperty, value);
}
public PenLineCap StrokeEndLineCap
{
get { return (PenLineCap)GetValue(StrokeEndLineCapProperty); }
set { SetValue(StrokeEndLineCapProperty, value); }
get => (PenLineCap)GetValue(StrokeEndLineCapProperty);
set => SetValue(StrokeEndLineCapProperty, value);
}
public PenLineJoin StrokeLineJoin
{
get { return (PenLineJoin)GetValue(StrokeLineJoinProperty); }
set { SetValue(StrokeLineJoinProperty, value); }
get => (PenLineJoin)GetValue(StrokeLineJoinProperty);
set => SetValue(StrokeLineJoinProperty, value);
}
public double StrokeMiterLimit
{
get { return (double)GetValue(StrokeMiterLimitProperty); }
set { SetValue(StrokeMiterLimitProperty, value); }
get => (double)GetValue(StrokeMiterLimitProperty);
set => SetValue(StrokeMiterLimitProperty, value);
}
}
}

View file

@ -45,8 +45,8 @@ namespace MapControl
public MapBase ParentMap
{
get { return parentMap; }
set { SetParentMap(value); }
get => parentMap;
set => SetParentMap(value);
}
/// <summary>

View file

@ -36,13 +36,13 @@ namespace MapControl
/// </summary>
public Location Location
{
get { return (Location)GetValue(LocationProperty); }
set { SetValue(LocationProperty, value); }
get => (Location)GetValue(LocationProperty);
set => SetValue(LocationProperty, value);
}
public MapBase ParentMap
{
get { return parentMap; }
get => parentMap;
set
{
if (parentMap != null)

View file

@ -34,8 +34,8 @@ namespace MapControl
#endif
public IEnumerable<Location> Locations
{
get { return (IEnumerable<Location>)GetValue(LocationsProperty); }
set { SetValue(LocationsProperty, value); }
get => (IEnumerable<Location>)GetValue(LocationsProperty);
set => SetValue(LocationsProperty, value);
}
public MapPolygon()

View file

@ -34,8 +34,8 @@ namespace MapControl
#endif
public IEnumerable<Location> Locations
{
get { return (IEnumerable<Location>)GetValue(LocationsProperty); }
set { SetValue(LocationsProperty, value); }
get => (IEnumerable<Location>)GetValue(LocationsProperty);
set => SetValue(LocationsProperty, value);
}
public MapPolyline()

View file

@ -63,8 +63,8 @@ namespace MapControl
public Thickness Padding
{
get { return (Thickness)GetValue(PaddingProperty); }
set { SetValue(PaddingProperty, value); }
get => (Thickness)GetValue(PaddingProperty);
set => SetValue(PaddingProperty, value);
}
protected override Size MeasureOverride(Size availableSize)

View file

@ -34,18 +34,12 @@ namespace MapControl
/// <summary>
/// A default MapTileLayer using OpenStreetMap data.
/// </summary>
public static MapTileLayer OpenStreetMapTileLayer
public static MapTileLayer OpenStreetMapTileLayer => new MapTileLayer
{
get
{
return new MapTileLayer
{
TileSource = new TileSource { UriFormat = "https://tile.openstreetmap.org/{z}/{x}/{y}.png" },
SourceName = "OpenStreetMap",
Description = "© [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
};
}
}
TileSource = new TileSource { UriFormat = "https://tile.openstreetmap.org/{z}/{x}/{y}.png" },
SourceName = "OpenStreetMap",
Description = "© [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
};
public static readonly DependencyProperty MinZoomLevelProperty = DependencyProperty.Register(
nameof(MinZoomLevel), typeof(int), typeof(MapTileLayer), new PropertyMetadata(0));
@ -75,8 +69,8 @@ namespace MapControl
/// </summary>
public int MinZoomLevel
{
get { return (int)GetValue(MinZoomLevelProperty); }
set { SetValue(MinZoomLevelProperty, value); }
get => (int)GetValue(MinZoomLevelProperty);
set => SetValue(MinZoomLevelProperty, value);
}
/// <summary>
@ -84,8 +78,8 @@ namespace MapControl
/// </summary>
public int MaxZoomLevel
{
get { return (int)GetValue(MaxZoomLevelProperty); }
set { SetValue(MaxZoomLevelProperty, value); }
get => (int)GetValue(MaxZoomLevelProperty);
set => SetValue(MaxZoomLevelProperty, value);
}
/// <summary>
@ -94,8 +88,8 @@ namespace MapControl
/// </summary>
public double ZoomLevelOffset
{
get { return (double)GetValue(ZoomLevelOffsetProperty); }
set { SetValue(ZoomLevelOffsetProperty, value); }
get => (double)GetValue(ZoomLevelOffsetProperty);
set => SetValue(ZoomLevelOffsetProperty, value);
}
protected override Size MeasureOverride(Size availableSize)

View file

@ -88,8 +88,8 @@ namespace MapControl
/// </summary>
public TileSource TileSource
{
get { return (TileSource)GetValue(TileSourceProperty); }
set { SetValue(TileSourceProperty, value); }
get => (TileSource)GetValue(TileSourceProperty);
set => SetValue(TileSourceProperty, value);
}
/// <summary>
@ -97,8 +97,8 @@ namespace MapControl
/// </summary>
public string SourceName
{
get { return (string)GetValue(SourceNameProperty); }
set { SetValue(SourceNameProperty, value); }
get => (string)GetValue(SourceNameProperty);
set => SetValue(SourceNameProperty, value);
}
/// <summary>
@ -106,8 +106,8 @@ namespace MapControl
/// </summary>
public string Description
{
get { return (string)GetValue(DescriptionProperty); }
set { SetValue(DescriptionProperty, value); }
get => (string)GetValue(DescriptionProperty);
set => SetValue(DescriptionProperty, value);
}
/// <summary>
@ -116,8 +116,8 @@ namespace MapControl
/// </summary>
public int MaxBackgroundLevels
{
get { return (int)GetValue(MaxBackgroundLevelsProperty); }
set { SetValue(MaxBackgroundLevelsProperty, value); }
get => (int)GetValue(MaxBackgroundLevelsProperty);
set => SetValue(MaxBackgroundLevelsProperty, value);
}
/// <summary>
@ -125,8 +125,8 @@ namespace MapControl
/// </summary>
public TimeSpan UpdateInterval
{
get { return (TimeSpan)GetValue(UpdateIntervalProperty); }
set { SetValue(UpdateIntervalProperty, value); }
get => (TimeSpan)GetValue(UpdateIntervalProperty);
set => SetValue(UpdateIntervalProperty, value);
}
/// <summary>
@ -134,8 +134,8 @@ namespace MapControl
/// </summary>
public bool UpdateWhileViewportChanging
{
get { return (bool)GetValue(UpdateWhileViewportChangingProperty); }
set { SetValue(UpdateWhileViewportChangingProperty, value); }
get => (bool)GetValue(UpdateWhileViewportChangingProperty);
set => SetValue(UpdateWhileViewportChangingProperty, value);
}
/// <summary>
@ -143,8 +143,8 @@ namespace MapControl
/// </summary>
public Brush MapBackground
{
get { return (Brush)GetValue(MapBackgroundProperty); }
set { SetValue(MapBackgroundProperty, value); }
get => (Brush)GetValue(MapBackgroundProperty);
set => SetValue(MapBackgroundProperty, value);
}
/// <summary>
@ -152,8 +152,8 @@ namespace MapControl
/// </summary>
public Brush MapForeground
{
get { return (Brush)GetValue(MapForegroundProperty); }
set { SetValue(MapForegroundProperty, value); }
get => (Brush)GetValue(MapForegroundProperty);
set => SetValue(MapForegroundProperty, value);
}
/// <summary>
@ -161,13 +161,13 @@ namespace MapControl
/// </summary>
public double LoadingProgress
{
get { return (double)GetValue(LoadingProgressProperty); }
private set { SetValue(LoadingProgressProperty, value); }
get => (double)GetValue(LoadingProgressProperty);
private set => SetValue(LoadingProgressProperty, value);
}
public MapBase ParentMap
{
get { return parentMap; }
get => parentMap;
set
{
if (parentMap != null)
@ -186,15 +186,7 @@ namespace MapControl
}
}
protected bool IsBaseMapLayer
{
get
{
return parentMap != null
&& parentMap.Children.Count > 0
&& parentMap.Children[0] == this;
}
}
protected bool IsBaseMapLayer => parentMap != null && parentMap.Children.Count > 0 && parentMap.Children[0] == this;
protected abstract void SetRenderTransform();

View file

@ -22,14 +22,14 @@ namespace MapControl
{
public Size ArrowSize
{
get { return (Size)GetValue(ArrowSizeProperty); }
set { SetValue(ArrowSizeProperty, value); }
get => (Size)GetValue(ArrowSizeProperty);
set => SetValue(ArrowSizeProperty, value);
}
public double BorderWidth
{
get { return (double)GetValue(BorderWidthProperty); }
set { SetValue(BorderWidthProperty, value); }
get => (double)GetValue(BorderWidthProperty);
set => SetValue(BorderWidthProperty, value);
}
protected virtual Geometry BuildGeometry()

View file

@ -29,7 +29,7 @@ namespace MapControl
/// </summary>
public string UriFormat
{
get { return uriFormat; }
get => uriFormat;
set
{
uriFormat = value?.Replace("{c}", "{s}"); // for backwards compatibility since 5.4.0

View file

@ -60,8 +60,8 @@ namespace MapControl
/// </summary>
public Uri ServiceUri
{
get { return (Uri)GetValue(ServiceUriProperty); }
set { SetValue(ServiceUriProperty, value); }
get => (Uri)GetValue(ServiceUriProperty);
set => SetValue(ServiceUriProperty, value);
}
/// <summary>
@ -69,8 +69,8 @@ namespace MapControl
/// </summary>
public string Layers
{
get { return (string)GetValue(LayersProperty); }
set { SetValue(LayersProperty, value); }
get => (string)GetValue(LayersProperty);
set => SetValue(LayersProperty, value);
}
/// <summary>
@ -78,8 +78,8 @@ namespace MapControl
/// </summary>
public string Styles
{
get { return (string)GetValue(StylesProperty); }
set { SetValue(StylesProperty, value); }
get => (string)GetValue(StylesProperty);
set => SetValue(StylesProperty, value);
}
/// <summary>

View file

@ -47,8 +47,8 @@ namespace MapControl
/// </summary>
public Uri CapabilitiesUri
{
get { return (Uri)GetValue(CapabilitiesUriProperty); }
set { SetValue(CapabilitiesUriProperty, value); }
get => (Uri)GetValue(CapabilitiesUriProperty);
set => SetValue(CapabilitiesUriProperty, value);
}
/// <summary>
@ -56,14 +56,11 @@ namespace MapControl
/// </summary>
public string LayerIdentifier
{
get { return (string)GetValue(LayerIdentifierProperty); }
set { SetValue(LayerIdentifierProperty, value); }
get => (string)GetValue(LayerIdentifierProperty);
set => SetValue(LayerIdentifierProperty, value);
}
public IEnumerable<WmtsTileMatrixLayer> ChildLayers
{
get { return Children.Cast<WmtsTileMatrixLayer>(); }
}
public IEnumerable<WmtsTileMatrixLayer> ChildLayers => Children.Cast<WmtsTileMatrixLayer>();
public Dictionary<string, WmtsTileMatrixSet> TileMatrixSets { get; } = new Dictionary<string, WmtsTileMatrixSet>();

View file

@ -25,10 +25,7 @@ namespace MapControl
/// Default folder path where an IImageCache instance may save cached data,
/// i.e. Windows.Storage.ApplicationData.Current.TemporaryFolder.Path.
/// </summary>
public static string DefaultCacheFolder
{
get { return Windows.Storage.ApplicationData.Current.TemporaryFolder.Path; }
}
public static string DefaultCacheFolder => Windows.Storage.ApplicationData.Current.TemporaryFolder.Path;
/// <summary>
/// An IImageCache implementation used to cache tile images.

View file

@ -21,20 +21,14 @@ namespace MapControl.Caching
private readonly MemoryCache memoryCache = MemoryCache.Default;
public override string Name
{
get { return string.Empty; }
}
public override string Name => string.Empty;
public override DefaultCacheCapabilities DefaultCacheCapabilities
{
get { return DefaultCacheCapabilities.None; }
}
public override DefaultCacheCapabilities DefaultCacheCapabilities => DefaultCacheCapabilities.None;
public override object this[string key]
{
get { return Get(key); }
set { Set(key, value, null); }
get => Get(key);
set => Set(key, value, null);
}
protected override IEnumerator<KeyValuePair<string, object>> GetEnumerator()

View file

@ -42,8 +42,8 @@ namespace MapControl
/// </summary>
public double MouseWheelZoomDelta
{
get { return (double)GetValue(MouseWheelZoomDeltaProperty); }
set { SetValue(MouseWheelZoomDeltaProperty, value); }
get => (double)GetValue(MouseWheelZoomDeltaProperty);
set => SetValue(MouseWheelZoomDeltaProperty, value);
}
/// <summary>
@ -51,8 +51,8 @@ namespace MapControl
/// </summary>
public ManipulationModes ManipulationMode
{
get { return (ManipulationModes)GetValue(ManipulationModeProperty); }
set { SetValue(ManipulationModeProperty, value); }
get => (ManipulationModes)GetValue(ManipulationModeProperty);
set => SetValue(ManipulationModeProperty, value);
}
private void OnManipulationStarted(object sender, ManipulationStartedEventArgs e)

View file

@ -26,8 +26,8 @@ namespace MapControl
/// </summary>
public bool AutoCollapse
{
get { return (bool)GetValue(AutoCollapseProperty); }
set { SetValue(AutoCollapseProperty, value); }
get => (bool)GetValue(AutoCollapseProperty);
set => SetValue(AutoCollapseProperty, value);
}
/// <summary>
@ -35,8 +35,8 @@ namespace MapControl
/// </summary>
public Location Location
{
get { return (Location)GetValue(LocationProperty); }
set { SetValue(LocationProperty, value); }
get => (Location)GetValue(LocationProperty);
set => SetValue(LocationProperty, value);
}
}
@ -55,8 +55,8 @@ namespace MapControl
public CornerRadius CornerRadius
{
get { return (CornerRadius)GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); }
get => (CornerRadius)GetValue(CornerRadiusProperty);
set => SetValue(CornerRadiusProperty, value);
}
}
}

View file

@ -25,8 +25,8 @@ namespace MapControl
public IEnumerable<IMapDrawingItem> ItemsSource
{
get { return (IEnumerable<IMapDrawingItem>)GetValue(ItemsSourceProperty); }
set { SetValue(ItemsSourceProperty, value); }
get => (IEnumerable<IMapDrawingItem>)GetValue(ItemsSourceProperty);
set => SetValue(ItemsSourceProperty, value);
}
protected override async Task<ImageSource> GetImageAsync(IProgress<double> progress)

View file

@ -27,8 +27,8 @@ namespace MapControl
/// </summary>
public IEnumerable<IEnumerable<Location>> Polygons
{
get { return (IEnumerable<IEnumerable<Location>>)GetValue(PolygonsProperty); }
set { SetValue(PolygonsProperty, value); }
get => (IEnumerable<IEnumerable<Location>>)GetValue(PolygonsProperty);
set => SetValue(PolygonsProperty, value);
}
public MapMultiPolygon()

View file

@ -18,14 +18,11 @@ namespace MapControl
public Geometry Data
{
get { return (Geometry)GetValue(DataProperty); }
set { SetValue(DataProperty, value); }
get => (Geometry)GetValue(DataProperty);
set => SetValue(DataProperty, value);
}
protected override Geometry DefiningGeometry
{
get { return Data; }
}
protected override Geometry DefiningGeometry => Data;
#region Methods used only by derived classes MapPolyline, MapPolygon and MapMultiPolygon

View file

@ -43,26 +43,26 @@ namespace MapControl
public Brush Background
{
get { return (Brush)GetValue(BackgroundProperty); }
set { SetValue(BackgroundProperty, value); }
get => (Brush)GetValue(BackgroundProperty);
set => SetValue(BackgroundProperty, value);
}
public Brush BorderBrush
{
get { return (Brush)GetValue(BorderBrushProperty); }
set { SetValue(BorderBrushProperty, value); }
get => (Brush)GetValue(BorderBrushProperty);
set => SetValue(BorderBrushProperty, value);
}
public CornerRadius CornerRadius
{
get { return (CornerRadius)GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); }
get => (CornerRadius)GetValue(CornerRadiusProperty);
set => SetValue(CornerRadiusProperty, value);
}
public Thickness Padding
{
get { return (Thickness)GetValue(PaddingProperty); }
set { SetValue(PaddingProperty, value); }
get => (Thickness)GetValue(PaddingProperty);
set => SetValue(PaddingProperty, value);
}
protected override Size MeasureOverride(Size constraint)

View file

@ -14,10 +14,8 @@ namespace MapControl
/// <summary>
/// Default folder path where an ObjectCache instance may save cached data, i.e. C:\ProgramData\MapControl\TileCache
/// </summary>
public static string DefaultCacheFolder
{
get { return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache"); }
}
public static string DefaultCacheFolder =>
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache");
/// <summary>
/// An ObjectCache instance used to cache tile image data. The default value is MemoryCache.Default.

View file

@ -45,8 +45,8 @@ namespace MapControl
/// </summary>
public double MouseWheelZoomDelta
{
get { return (double)GetValue(MouseWheelZoomDeltaProperty); }
set { SetValue(MouseWheelZoomDeltaProperty, value); }
get => (double)GetValue(MouseWheelZoomDeltaProperty);
set => SetValue(MouseWheelZoomDeltaProperty, value);
}
private void OnPointerWheelChanged(object sender, PointerRoutedEventArgs e)

View file

@ -36,8 +36,8 @@ namespace MapControl
/// </summary>
public bool AutoCollapse
{
get { return (bool)GetValue(AutoCollapseProperty); }
set { SetValue(AutoCollapseProperty, value); }
get => (bool)GetValue(AutoCollapseProperty);
set => SetValue(AutoCollapseProperty, value);
}
/// <summary>
@ -45,8 +45,8 @@ namespace MapControl
/// </summary>
public Location Location
{
get { return (Location)GetValue(LocationProperty); }
set { SetValue(LocationProperty, value); }
get => (Location)GetValue(LocationProperty);
set => SetValue(LocationProperty, value);
}
protected override void OnApplyTemplate()

View file

@ -80,8 +80,8 @@ namespace MapControl
public UIElement Child
{
get { return border.Child; }
set { border.Child = value; }
get => border.Child;
set => border.Child = value;
}
private void SetBorderMargin()

View file

@ -25,10 +25,8 @@ namespace MapControl
/// <summary>
/// Default folder path where an IImageCache instance may save cached data, i.e. C:\ProgramData\MapControl\TileCache
/// </summary>
public static string DefaultCacheFolder
{
get { return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache"); }
}
public static string DefaultCacheFolder =>
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache");
/// <summary>
/// An IImageCache implementation used to cache tile images.