ArcGIS Runtime SDK for .NET Samples

Generate Offline Map (Overrides)

Generate an offline map using parameter overrides

Loading

Code

<UserControl x:Class="ArcGISRuntime.WPF.Samples.GenerateOfflineMapWithOverrides.GenerateOfflineMapWithOverrides"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
    <Grid>
        <esri:MapView x:Name="MyMapView" />

        <Border x:Name="takeOfflineArea" Background="White" BorderBrush="Black" BorderThickness="1"
                HorizontalAlignment="Right" VerticalAlignment="Top"
                Margin="30" Padding="20" Width="375">
            <Grid>
                <Grid.Resources>
                    <Style TargetType="TextBlock">
                        <Setter Property="Margin" Value="0,0,0,5" />
                    </Style>
                    <Style TargetType="TextBox">
                        <Setter Property="Margin" Value="0,0,0,5" />
                    </Style>
                    <Style TargetType="CheckBox">
                        <Setter Property="Margin" Value="0,0,0,5" />
                    </Style>
                    <Style TargetType="Slider">
                        <Setter Property="Margin" Value="0,0,5,0" />
                    </Style>
                </Grid.Resources>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <TextBlock Text="Adjust the basemap"
                           FontWeight="SemiBold"
                           Grid.Row="0" Grid.Column="0" />
                <TextBlock Text="Min scale:"
                           Grid.Row="1" Grid.Column="0" />
                <Slider x:Name="MinScaleEntry"
                         Value="0"
                         Minimum="0" Maximum="23"
                         Grid.Row="1" Grid.Column="1" />
                <TextBlock Text="{Binding ElementName=MinScaleEntry,Path=Value,StringFormat=n0}"
                           Grid.Row="1" Grid.Column="2" />
                <TextBlock Text="Max scale:"
                           Grid.Row="2" Grid.Column="0" />
                <Slider x:Name="MaxScaleEntry"
                         Value="23" Minimum="0" Maximum="23"
                         Grid.Row="2" Grid.Column="1" />
                <TextBlock Text="{Binding ElementName=MaxScaleEntry,Path=Value,StringFormat=n0}"
                           Grid.Row="2" Grid.Column="2" />
                <TextBlock Text="Extent buffer distance (m):"
                           Grid.Row="3" Grid.Column="0" />
                <Slider x:Name="ExtentBufferEntry"
                         Value="250" Minimum="0" Maximum="500"
                         Grid.Row="3" Grid.Column="1" />
                <TextBlock Text="{Binding ElementName=ExtentBufferEntry,Path=Value,StringFormat=n0}"
                           Grid.Row="3" Grid.Column="2" />
                <TextBlock Text="Choose layers"
                           FontWeight="SemiBold"
                           Grid.Row="4" Grid.Column="0" />
                <CheckBox x:Name="SysValvesLayerCheckbox"
                          Content="System Valves"
                          IsChecked="True"
                          Grid.Row="5" Grid.Column="0" />
                <CheckBox x:Name="ServiceConnCheckbox"
                          Content="Service Connections"
                          Grid.Row="6" Grid.Column="0" />
                <TextBlock Text="Apply a feature layer filer"
                           FontWeight="SemiBold"
                           Margin="0,0,0,5"
                           Grid.Row="7" Grid.Column="0" />
                <TextBlock Text="Min Hydrant Flow Rate (GPM):"
                           Margin="0,0,5,5"
                           Grid.Row="8" Grid.Column="0" />
                <Slider x:Name="FlowRateFilterEntry"
                         Value="500" Minimum="0" Maximum="999"
                         Grid.Row="8" Grid.Column="1" />
                <TextBlock Text="{Binding ElementName=FlowRateFilterEntry,Path=Value,StringFormat=n0}"
                           Grid.Row="8" Grid.Column="2"
                           MinWidth="25"/>
                <TextBlock Text="Crop layer to extent"
                           FontWeight="SemiBold"
                           Margin="0,0,0,5"
                           Grid.Row="9" Grid.Column="0" />
                <CheckBox x:Name="CropLayerCheckbox"
                          Content="Water pipes"
                          Grid.Row="10" Grid.Column="0" />
                <Button Content="Take map offline"
                        Grid.Row="11" Grid.Column="0" Grid.ColumnSpan="3"
                        IsEnabled="True"
                        Click="TakeMapOfflineButton_Click" />
            </Grid>
        </Border>

        <Border x:Name="MessageArea" Visibility="Collapsed"
                Background="White" BorderBrush="Black" BorderThickness="1"
                HorizontalAlignment="Right" VerticalAlignment="Top"
                Margin="30" Padding="5" Width="450">
            <StackPanel>
                <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10"
                           FontWeight="Bold"
                           Text="Map is offline!" />
            </StackPanel>
        </Border>

        <Grid x:Name="BusyIndicator" Background="#807f7f7f" Visibility="Collapsed">
            <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
                <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10"
                           Foreground="White" FontSize="18">
                    <Run Text="Generating offline map... " />
                    <Run x:Name="Percentage" Text="" />
                </TextBlock>
                <ProgressBar x:Name="ProgressBar"
                             Grid.Row="1"
                             Minimum="0" Maximum="100"
                             IsEnabled="True"
                             HorizontalAlignment="Center" VerticalAlignment="Center"
                             Width="100" Height="10" Margin="0,0,0,10" />
                <Button Content="Cancel"
                        Grid.Row="2"
                        HorizontalAlignment="Center"
                        Width="100"
                        Click="CancelJobButton_Click" />
            </Grid>
        </Grid>
        <Grid x:Name="LoadingIndicator"
              Background="#807f7f7f"
              Visibility="Visible">
            <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
                <TextBlock Text="Loading online map..."
                           Foreground="White" FontSize="18"
                           Margin="10" />
                <ProgressBar Grid.Row="1"
                             IsEnabled="True" IsIndeterminate="True"
                             Width="100" Height="10"
                             HorizontalAlignment="Center" VerticalAlignment="Center" />
            </Grid>
        </Grid>
    </Grid>
</UserControl>


In this topic
  1. Code