Attachment Editor Online

This sample demonstrates using the ESRI.ArcGIS.Client.Toolkit AttachmentEditor to upload, download, and delete files associated with selected features in a FeatureLayer.

To use the sample, select a point feature and click the 'Add' button to attach a file. To download an attachment for a selected feature, click the hyperlink for the filename. To delete an attachment associated with a selected feature click the red X next to the file name.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.ToolkitAttachmentEditor"
        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/client/2009">

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.Resources>
            <LinearGradientBrush x:Key="PanelGradient" EndPoint="0.5,1" StartPoint="0.5,0">
                <LinearGradientBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterY="0.5" CenterX="0.5"/>
                        <SkewTransform CenterY="0.5" CenterX="0.5"/>
                        <RotateTransform Angle="176" CenterY="0.5" CenterX="0.5"/>
                        <TranslateTransform/>
                    </TransformGroup>
                </LinearGradientBrush.RelativeTransform>
                <GradientStop Color="#FF145787"/>
                <GradientStop Color="#FF3D7FAC" Offset="0.184"/>
                <GradientStop Color="#FF88C5EF" Offset="0.984"/>
            </LinearGradientBrush>
        </Grid.Resources>

        <esri:Map x:Name="MyMap" Loaded="MyMap_Loaded" WrapAround="True" >
            <esri:ArcGISTiledMapServiceLayer 
                Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
            <esri:FeatureLayer ID="lyrIncidents" AutoSave="False" Initialized="FeatureLayer_Initialized" 
                               DisableClientCaching="True" OutFields="*" Mode="OnDemand"
                               Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0">
            </esri:FeatureLayer>
        </esri:Map>

        <Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,15,15,0" >
            <Rectangle Fill="{StaticResource PanelGradient}" Stroke="Gray"  RadiusX="10" RadiusY="10" Margin="0,0,0,5">
                <Rectangle.Effect>
                    <DropShadowEffect/>
                </Rectangle.Effect>
            </Rectangle>
            <Rectangle Fill="#FFFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="10,10,10,15" />

            <StackPanel x:Name="myStack" Orientation="Vertical">
                <TextBlock Text="Click on a point feature to select it, and click the 'Add' button to attach a file." 
                       Width="275" TextAlignment="Left" Margin="20,20,20,5" TextWrapping="Wrap" FontWeight="Bold" Foreground="Black"/>
                <esri:AttachmentEditor x:Name="attachmentEditor" VerticalAlignment="Top" Margin="20,5,20,20" 
                             Background="WhiteSmoke" Width="280" Height="190" HorizontalAlignment="Right"                                                           
                             Filter="All Files (*.*)|*.*|Image Files|*.tif;*.jpg;*.gif;*.png;*.bmp|Text Files (.txt)|*.txt" 
                             FilterIndex="1" Multiselect="True"
                             UploadFailed="attachmentEditor_UploadFailed">
                </esri:AttachmentEditor>
            </StackPanel>
        </Grid>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014