Skip To Content ArcGIS for Developers Sign In Dashboard

Edit feature attachments

Editing attachments for a feature

Loading

<UserControl
    x:Class="ArcGISRuntime.UWP.Samples.EditFeatureAttachments.EditFeatureAttachments"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
    <Grid>
        <esriUI:MapView x:Name="MyMapView" />
        <Border Style="{StaticResource BorderStyle}">
            <Grid>
                <StackPanel Orientation="Vertical">
                    <TextBlock Text="Tap features to select."
                               TextAlignment="Center"
                               Margin="0,0,0,5"
                               FontWeight="SemiBold" />
                    <ListBox x:Name="AttachmentsListBox"
                             IsEnabled="False"
                             MinHeight="100"
                             MaxHeight="300"
                             HorizontalContentAlignment="Stretch"
                             HorizontalAlignment="Stretch"
                             Background="LightGray">
                        <ListBox.ItemContainerStyle>
                            <Style TargetType="ListBoxItem">
                                <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                                <Setter Property="HorizontalAlignment" Value="Stretch" />
                            </Style>
                        </ListBox.ItemContainerStyle>
                        <!-- ItemTemplate defines how each item (Attachment) is rendered. -->
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Text="{Binding Name}"
                                               VerticalAlignment="Center" />
                                    <!-- DataTemplate sets the item as the button's DataContext automatically. -->
                                    <Button Content="💾"
                                            Grid.Column="1"
                                            HorizontalAlignment="Right"
                                            Margin="0,0,5,0"
                                            Click="DownloadAttachment_Click" />
                                    <!-- These symbols are emojis. Use Win+. to open the emoji picker. -->
                                    <Button Content="🗑"
                                            Grid.Column="2"
                                            HorizontalAlignment="Right"
                                            Click="DeleteAttachment_Click" />
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                    <Button x:Name="AddAttachmentButton"
                            Content="Add attachment"
                            IsEnabled="False"
                            Margin="0,5,0,5"
                            HorizontalAlignment="Stretch"
                            Click="AddAttachment_Click" />
                    <ProgressBar x:Name="ActivityIndicator"
                                 IsIndeterminate="True"
                                 HorizontalAlignment="Stretch"
                                 Visibility="Collapsed"
                                 Height="15" />
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</UserControl>

In this topic
  1. Code