CSV Layer Online

This sample demonstrates the use of the CSVLayer type. CSVLayer is designed to read and render text files that contain delimited values where at least two of the delimited columns reference an X and Y value. Note, CSVLayer only supports point geometry. The CSVLayer derives from GraphicsLayer and thus inherits the ability to define renderers and map tips. In this example a text file, hosted by the USGS, contains comma delimited values, and two of the columns are recognized to contain X and Y values from which to construct point geometry. A set of fields are automatically detected to contain X and Y values, such as "latitude", "y", "longitude", "x". Use XFieldName and YFieldName to set explicitly. CSVLayer provides some optional properties to handle properties of source files. For example, by default, the CSVLayer assumes a spatial reference of geographic WGS84 (WKID: 4326). Use SourceSpatialReference to set explicitly. The default column delimiter is a comma (,). Use ColumnDelimeter to set explicitly.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.CSVSimple"
  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>
            <esri:SimpleMarkerSymbol x:Key="mag2to3" Color="#FF0A57FC" Size="12" Style="Triangle" />
            <esri:SimpleMarkerSymbol x:Key="mag3to4" Color="#FF1CA2A3" Size="12" Style="Triangle" />
            <esri:SimpleMarkerSymbol x:Key="mag4to5" Color="#FF60AD12" Size="12" Style="Triangle" />
            <esri:SimpleMarkerSymbol x:Key="mag5to6" Color="#FFFFFE0A" Size="12" Style="Triangle" />
            <esri:SimpleMarkerSymbol x:Key="mag6to7" Color="#FFFDA208" Size="12" Style="Triangle" />
            <esri:SimpleMarkerSymbol x:Key="mag7to8" Color="#FFFB5107" Size="12" Style="Triangle" />
            <esri:ClassBreaksRenderer x:Key="MyClassBreaksRenderer" Field="Magnitude" >
                <esri:ClassBreaksRenderer.Classes>
                    <esri:ClassBreakInfo MinimumValue="2" MaximumValue="3" Symbol="{StaticResource mag2to3}" />
                    <esri:ClassBreakInfo MinimumValue="3" MaximumValue="4" Symbol="{StaticResource mag3to4}" />
                    <esri:ClassBreakInfo MinimumValue="4" MaximumValue="5" Symbol="{StaticResource mag4to5}" />
                    <esri:ClassBreakInfo MinimumValue="5" MaximumValue="6" Symbol="{StaticResource mag5to6}" />
                    <esri:ClassBreakInfo MinimumValue="6" MaximumValue="7" Symbol="{StaticResource mag6to7}" />
                    <esri:ClassBreakInfo MinimumValue="7" MaximumValue="8" Symbol="{StaticResource mag7to8}" />
                </esri:ClassBreaksRenderer.Classes>
            </esri:ClassBreaksRenderer>
        </Grid.Resources>
        <esri:Map WrapAround="True" UseAcceleratedDisplay="True">
            <esri:ArcGISLocalTiledLayer ID="BaseMap" Path="..\Data\TPKs\Topographic.tpk"/>
            <esri:CsvLayer Url="http://earthquake.usgs.gov/earthquakes/catalogs/eqs7day-M2.5.txt" 
                           Renderer="{StaticResource MyClassBreaksRenderer}">
                <esri:CsvLayer.MapTip>
                    <Border BorderBrush="Black" BorderThickness="1" Margin="0,0,15,15" Background="White">
                        <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="10">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Magnitude: " FontWeight="Bold" Foreground="#FF0F274E" FontSize="10" VerticalAlignment="Center"/>
                                <TextBlock Text="{Binding [Magnitude ]}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Depth: " FontWeight="Bold" Foreground="#FF0F274E" FontSize="10" VerticalAlignment="Center" />
                                <TextBlock Text="{Binding [Depth ]}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                            </StackPanel>
                        </StackPanel>
                    </Border>
                </esri:CsvLayer.MapTip>
            </esri:CsvLayer>
        </esri:Map>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014