-
Notifications
You must be signed in to change notification settings - Fork 523
/
Copy pathMapReferenceScale.xaml
56 lines (56 loc) · 3.65 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
50
51
52
53
54
55
56
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="ArcGIS.Samples.MapReferenceScale.MapReferenceScale"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Maui;assembly=Esri.ArcGISRuntime.Maui"
xmlns:mapping="clr-namespace:Esri.ArcGISRuntime.Mapping;assembly=Esri.ArcGISRuntime"
xmlns:resources="clr-namespace:ArcGIS.Resources">
<Grid Style="{DynamicResource EsriSampleContainer}">
<esriUI:MapView x:Name="MyMapView" Style="{DynamicResource EsriSampleGeoView}" />
<Border Style="{DynamicResource EsriSampleControlPanel}">
<ScrollView Padding="5" MaximumHeightRequest="300">
<VerticalStackLayout>
<Label 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. -->
<Picker x:Name="ReferenceScaleBox"
Margin="5"
BindingContext="{x:Reference MyMapView}"
ItemDisplayBinding="{Binding StringFormat='{0:n0}'}"
SelectedItem="{Binding Path=Map.ReferenceScale}"
VerticalOptions="Center" />
<Label 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="5"
BindingContext="{x:Reference MyMapView}"
HeightRequest="150"
ItemsSource="{Binding Path=Map.OperationalLayers}"
SelectionMode="None"
VerticalOptions="Center">
<ListView.ItemTemplate>
<!-- https://github.com/dotnet/maui/issues/20002 -->
<!-- DataType needs to be explicitly set to display DataTemplate content in release mode configuration -->
<DataTemplate x:DataType="{x:Type mapping:FeatureLayer}">
<ViewCell>
<!--
When the user interacts with the switch,
the two-way binding will update the ScaleSymbols (bool) property automatically.
-->
<StackLayout Orientation="Horizontal">
<Switch Margin="2"
IsToggled="{Binding ScaleSymbols}"
VerticalOptions="Center" />
<Label HorizontalOptions="CenterAndExpand"
HorizontalTextAlignment="Center"
Text="{Binding Name}"
VerticalOptions="Center" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Label BindingContext="{x:Reference MyMapView}" Text="{Binding Path=MapScale, Mode=OneWay, StringFormat='Current map scale: {0:n0}'}" />
</VerticalStackLayout>
</ScrollView>
</Border>
</Grid>
</ContentPage>