DependencyPropertyHelper

This commit is contained in:
ClemensFischer 2024-05-23 18:22:52 +02:00
parent 8e82e0bcbd
commit bc12b388de
20 changed files with 90 additions and 79 deletions

View file

@ -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>