-
Notifications
You must be signed in to change notification settings - Fork 524
/
Copy pathMapReferenceScale.xaml
49 lines (49 loc) · 2.91 KB
/
MapReferenceScale.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<UserControl x:Class="ArcGIS.WinUI.Samples.MapReferenceScale.MapReferenceScale"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:ArcGIS.WinUI.Viewer.Converters"
xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls"
xmlns:mapping="using:Esri.ArcGISRuntime.Mapping">
<UserControl.Resources>
<converters:DoubleToScaleStringConverter x:Key="DoubleToScaleStringConverter" />
</UserControl.Resources>
<Grid>
<esriUI:MapView x:Name="MyMapView" />
<Border Style="{StaticResource BorderStyle}">
<StackPanel>
<TextBlock FontWeight="SemiBold" Text="Choose a map reference scale:" />
<!-- When the user's selection changes, the SelectedItem binding will apply the value to the Map's ReferenceScale property. -->
<ComboBox x:Name="ReferenceScaleBox"
Margin="0,5,0,5"
HorizontalAlignment="Stretch"
SelectedItem="{Binding ElementName=MyMapView, Path=Map.ReferenceScale, Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<!-- The value converter converts from a double to a string that looks like a map scale. -->
<TextBlock Text="{Binding Converter={StaticResource DoubleToScaleStringConverter}}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock FontWeight="SemiBold" Text="Choose layers to apply scale to:" />
<!-- Binding is used to display the operational layers for the map view's map, no code behind needed. -->
<ListView Margin="0,5,0,5"
ItemsSource="{Binding ElementName=MyMapView, Path=Map.OperationalLayers}"
SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate x:DataType="mapping:FeatureLayer">
<!--
When the user interacts with the checkbox,
the two-way binding will update the ScaleSymbols (bool) property automatically.
-->
<CheckBox Content="{Binding Name}" IsChecked="{Binding ScaleSymbols, Mode=TwoWay}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<TextBlock>
<Run Text="Current map scale: " />
<Run Text="{Binding ElementName=MyMapView, Path=MapScale, Mode=OneWay, Converter={StaticResource DoubleToScaleStringConverter}}" />
</TextBlock>
</StackPanel>
</Border>
</Grid>
</UserControl>