Skip To Content ArcGIS for Developers Sign In Dashboard

Edit feature attachments

Editing attachments for a feature

Loading

<?xml version="1.0" encoding="utf-8"?>

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
             xmlns:resources="clr-namespace:Forms.Resources;assembly=ArcGISRuntime"
             x:Class="ArcGISRuntimeXamarin.Samples.EditFeatureAttachments.EditFeatureAttachments">
    <RelativeLayout>
        <esriUI:MapView x:Name="MyMapView" Style="{StaticResource MapWithFormStyle}"
                        BindingContext="{x:Reference Name=ResponsiveFormContainer}" />
        <resources:ResponsiveFormContainer x:Name="ResponsiveFormContainer">
            <Grid>
                <StackLayout Orientation="Vertical">
                    <Label Text="Tap features to select."
                           HorizontalTextAlignment="Center"
                           Margin="0,0,0,5"
                           FontAttributes="Bold" />
                    <ListView x:Name="AttachmentsListBox"
                              IsEnabled="False"
                              HeightRequest="100"
                              BackgroundColor="LightGray">
                        <!-- ItemTemplate defines how each item (Attachment) is rendered. -->
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <ViewCell>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="Auto" />
                                            <ColumnDefinition Width="Auto" />
                                        </Grid.ColumnDefinitions>
                                        <Label Text="{Binding Name}"
                                               Margin="5,0,5,0"
                                               VerticalTextAlignment="Center" />
                                        <!-- DataTemplate sets the item as the button's DataContext automatically. -->
                                        <Button Text="🔎"
                                                Grid.Column="1"
                                                VerticalOptions="End"
                                                Margin="0,0,5,0"
                                                Clicked="DownloadAttachment_Click" />
                                        <!-- These symbols are emojis. Use Win+. on Windows to open the emoji picker. -->
                                        <Button Text="🗑"
                                                Grid.Column="2"
                                                VerticalOptions="End"
                                                Clicked="DeleteAttachment_Click" />
                                    </Grid>
                                </ViewCell>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
                    <Button x:Name="AddAttachmentButton"
                            Text="Add attachment"
                            IsEnabled="False"
                            Margin="0,5,0,5"
                            Clicked="AddAttachment_Click" />
                    <ActivityIndicator x:Name="AttachmentActivityIndicator"
                                       IsVisible="False"
                                       IsRunning="True" />
                </StackLayout>
            </Grid>
        </resources:ResponsiveFormContainer>
    </RelativeLayout>
</ContentPage>

In this topic
  1. Code