mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Version 7.3. Added tile and map image progress reporting.
This commit is contained in:
parent
3119c0fc9b
commit
17fdd63ce9
|
|
@ -61,8 +61,7 @@ namespace MapControl
|
|||
nameof(MapForeground), typeof(Brush), typeof(MapTileLayerBase), new PropertyMetadata(null));
|
||||
|
||||
public static readonly DependencyProperty LoadingProgressProperty = DependencyProperty.Register(
|
||||
nameof(LoadingProgress), typeof(double), typeof(MapTileLayerBase), new PropertyMetadata(1d,
|
||||
(o, e) => { System.Diagnostics.Debug.WriteLine("LoadingProgress = {0:P0}", e.NewValue); }));
|
||||
nameof(LoadingProgress), typeof(double), typeof(MapTileLayerBase), new PropertyMetadata(1d));
|
||||
|
||||
private readonly DispatcherTimer updateTimer;
|
||||
private MapBase parentMap;
|
||||
|
|
|
|||
|
|
@ -45,25 +45,25 @@ namespace MapControl
|
|||
|
||||
path.SetBinding(Shape.FillProperty, new Binding
|
||||
{
|
||||
Path = new PropertyPath("Background"),
|
||||
Path = new PropertyPath(nameof(Background)),
|
||||
Source = this
|
||||
});
|
||||
|
||||
path.SetBinding(Shape.StrokeProperty, new Binding
|
||||
{
|
||||
Path = new PropertyPath("BorderBrush"),
|
||||
Path = new PropertyPath(nameof(BorderBrush)),
|
||||
Source = this
|
||||
});
|
||||
|
||||
path.SetBinding(Shape.StrokeThicknessProperty, new Binding
|
||||
{
|
||||
Path = new PropertyPath("BorderThickness"),
|
||||
Path = new PropertyPath(nameof(BorderWidth)),
|
||||
Source = this
|
||||
});
|
||||
|
||||
border.SetBinding(PaddingProperty, new Binding
|
||||
{
|
||||
Path = new PropertyPath("Padding"),
|
||||
Path = new PropertyPath(nameof(Padding)),
|
||||
Source = this
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,30 +1,25 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
#if WINUI
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
#elif UWP
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Data;
|
||||
#else
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
#endif
|
||||
|
||||
namespace SampleApplication
|
||||
{
|
||||
public class DoubleToVisibilityConverter : IValueConverter
|
||||
public class DoubleTriggerConverter : IValueConverter
|
||||
{
|
||||
public double Trigger { get; set; }
|
||||
public object TriggerValue { get; set; }
|
||||
public object DefaultValue { get; set; }
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if (!(parameter is double p))
|
||||
{
|
||||
p = double.Parse(parameter.ToString());
|
||||
}
|
||||
var converter = TypeDescriptor.GetConverter(targetType);
|
||||
|
||||
//System.Diagnostics.Debug.WriteLine((double)value);
|
||||
|
||||
return (double)value != p ? Visibility.Visible : Visibility.Collapsed;
|
||||
return (double)value == Trigger ? converter.ConvertFrom(TriggerValue) : converter.ConvertFrom(DefaultValue);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
|
|
|
|||
|
|
@ -80,8 +80,6 @@
|
|||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<local:DoubleToVisibilityConverter x:Key="DoubleToVisibilityConverter"/>
|
||||
</Grid.Resources>
|
||||
|
||||
<Grid.DataContext>
|
||||
|
|
@ -113,10 +111,28 @@
|
|||
</map:Pushpin>
|
||||
</map:Map>
|
||||
|
||||
<Border HorizontalAlignment="Right" VerticalAlignment="Bottom" Background="#BFFFFFFF">
|
||||
<TextBlock Margin="2" FontSize="10"
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Background="#AFFFFFFF">
|
||||
<ProgressBar Width="100" Height="10" Margin="4,2" Maximum="1"
|
||||
Value="{Binding MapLayer.LoadingProgress, ElementName=map}">
|
||||
<ProgressBar.IsIndeterminate>
|
||||
<Binding Path="Value" RelativeSource="{RelativeSource Self}">
|
||||
<Binding.Converter>
|
||||
<local:DoubleTriggerConverter Trigger="0" TriggerValue="true" DefaultValue="false"/>
|
||||
</Binding.Converter>
|
||||
</Binding>
|
||||
</ProgressBar.IsIndeterminate>
|
||||
<ProgressBar.Visibility>
|
||||
<Binding Path="Value" RelativeSource="{RelativeSource Self}">
|
||||
<Binding.Converter>
|
||||
<local:DoubleTriggerConverter Trigger="1" TriggerValue="Collapsed" DefaultValue="Visible"/>
|
||||
</Binding.Converter>
|
||||
</Binding>
|
||||
</ProgressBar.Visibility>
|
||||
</ProgressBar>
|
||||
|
||||
<TextBlock Margin="4,2" FontSize="10"
|
||||
local:HyperlinkText.InlinesSource="{Binding MapLayer.Description, ElementName=map}"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
<Border HorizontalAlignment="Center" VerticalAlignment="Top" Margin="4"
|
||||
Background="#AFFFFFFF" IsHitTestVisible="False">
|
||||
|
|
@ -216,8 +232,14 @@
|
|||
Maximum="{Binding MaxZoomLevel, ElementName=map}"
|
||||
Value="{Binding TargetZoomLevel, ElementName=map, Mode=TwoWay}"/>
|
||||
|
||||
<Button Margin="2" Padding="8" ToolTipService.ToolTip="Reset Heading" Click="ResetHeadingButtonClick"
|
||||
Visibility="{Binding Heading, ElementName=map, Converter={StaticResource DoubleToVisibilityConverter}, ConverterParameter=0}">
|
||||
<Button Margin="2" Padding="8" ToolTipService.ToolTip="Reset Heading" Click="ResetHeadingButtonClick">
|
||||
<Button.Visibility>
|
||||
<Binding Path="Heading" ElementName="map">
|
||||
<Binding.Converter>
|
||||
<local:DoubleTriggerConverter Trigger="0" TriggerValue="Collapsed" DefaultValue="Visible"/>
|
||||
</Binding.Converter>
|
||||
</Binding>
|
||||
</Button.Visibility>
|
||||
<FontIcon Glyph=""/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
|
|
|||
|
|
@ -80,8 +80,6 @@
|
|||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<local:DoubleToVisibilityConverter x:Key="DoubleToVisibilityConverter"/>
|
||||
</Grid.Resources>
|
||||
|
||||
<Grid.DataContext>
|
||||
|
|
@ -113,11 +111,24 @@
|
|||
</map:Pushpin>
|
||||
</map:Map>
|
||||
|
||||
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Background="#AFFFFFFF">
|
||||
<ProgressBar Width="100" Height="10" Margin="4,2" Maximum="1"
|
||||
Value="{Binding MapLayer.LoadingProgress, ElementName=map}"
|
||||
Visibility="{Binding Value, RelativeSource={RelativeSource Self}, Converter={StaticResource DoubleToVisibilityConverter}, ConverterParameter=1}"/>
|
||||
Value="{Binding MapLayer.LoadingProgress, ElementName=map}">
|
||||
<ProgressBar.IsIndeterminate>
|
||||
<Binding Path="Value" RelativeSource="{RelativeSource Self}">
|
||||
<Binding.Converter>
|
||||
<local:DoubleTriggerConverter Trigger="0" TriggerValue="true" DefaultValue="false"/>
|
||||
</Binding.Converter>
|
||||
</Binding>
|
||||
</ProgressBar.IsIndeterminate>
|
||||
<ProgressBar.Visibility>
|
||||
<Binding Path="Value" RelativeSource="{RelativeSource Self}">
|
||||
<Binding.Converter>
|
||||
<local:DoubleTriggerConverter Trigger="1" TriggerValue="Collapsed" DefaultValue="Visible"/>
|
||||
</Binding.Converter>
|
||||
</Binding>
|
||||
</ProgressBar.Visibility>
|
||||
</ProgressBar>
|
||||
|
||||
<TextBlock Margin="4,2" FontSize="10"
|
||||
local:HyperlinkText.InlinesSource="{Binding MapLayer.Description, ElementName=map}"/>
|
||||
|
|
@ -220,8 +231,14 @@
|
|||
Maximum="{Binding MaxZoomLevel, ElementName=map}"
|
||||
Value="{Binding TargetZoomLevel, ElementName=map, Mode=TwoWay}"/>
|
||||
|
||||
<Button Margin="2" Padding="8" ToolTipService.ToolTip="Reset Heading" Click="ResetHeadingButtonClick"
|
||||
Visibility="{Binding Heading, ElementName=map, Converter={StaticResource DoubleToVisibilityConverter}, ConverterParameter=0}">
|
||||
<Button Margin="2" Padding="8" ToolTipService.ToolTip="Reset Heading" Click="ResetHeadingButtonClick">
|
||||
<Button.Visibility>
|
||||
<Binding Path="Heading" ElementName="map">
|
||||
<Binding.Converter>
|
||||
<local:DoubleTriggerConverter Trigger="0" TriggerValue="Collapsed" DefaultValue="Visible"/>
|
||||
</Binding.Converter>
|
||||
</Binding>
|
||||
</Button.Visibility>
|
||||
<FontIcon Glyph=""/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="BingMapsApiKey.txt" />
|
||||
<Compile Remove="..\Shared\ValueConverters.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
Loading…
Reference in a new issue