Moving Objects

This sample demonstrates an approach to displaying real time feeds of data on the map. The objects in this example are exposed as a Satellites class which implements IEnumerable<Graphic>. This means the class can act as the collection of Graphics contained by the GraphicsLayer via data binding. The Satellites class also exposes two properties: number of satellites; and update speed. These properties provide the items content for the two ComboBoxes on the UI again via data binding and propagate any changes on the UI down to the Satellites class.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.MovingObjects"
             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"
             xmlns:local="clr-namespace:ArcGISWPFSDK">
    <Grid x:Name="LayoutRoot">
        <Grid.Resources>

            <local:Satellites x:Key="satellites" />

            <esri:PictureMarkerSymbol x:Key="SatellitePictureMarkerSymbol" Source="/Assets/Images/Satellite64.png" Width="24" Height="24"/>
            <esri:SimpleRenderer x:Key="SatelliteSimpleRenderer" Symbol="{StaticResource SatellitePictureMarkerSymbol}"/>

            <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" Offset="0.16"/>
                <GradientStop Color="#FF3D7FAC" Offset="0.502"/>
                <GradientStop Color="#FF88C5EF" Offset="0.984"/>
            </LinearGradientBrush>

            <Style x:Key="ComboStyle" TargetType="{x:Type ComboBox}">
                <Setter Property="HorizontalContentAlignment" Value="Right" />
                <Setter Property="VerticalContentAlignment" Value="Center"/>
            </Style>

        </Grid.Resources>
        <esri:Map x:Name="_map" UseAcceleratedDisplay="True" WrapAround="True">
            <!-- ArcGIS Online Tiled Basemap Layer -->
            <esri:ArcGISTiledMapServiceLayer ID="World Topo Map" 
                       Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>

            <esri:GraphicsLayer ID="MyGraphicsLayer" 
                                GraphicsSource="{StaticResource satellites}" Renderer="{StaticResource SatelliteSimpleRenderer}"/>
        </esri:Map>

        <Grid HorizontalAlignment="Left" VerticalAlignment="Top" Margin="15,15,15,0" Width="275">
            <Rectangle Fill="{StaticResource PanelGradient}" Stroke="Gray"  RadiusX="10" RadiusY="10" Margin="0,0,0,5">
                <Rectangle.Effect>
                    <DropShadowEffect/>
                </Rectangle.Effect>
            </Rectangle>
            <Rectangle Fill="#DDFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="5,5,5,10" />
            <StackPanel Orientation="Vertical" Margin="10,10,10,10" HorizontalAlignment="Left" >
                <TextBlock Text="Use the options below to change the number of satellites and the update speed of the satellites." 
                           TextWrapping="Wrap" HorizontalAlignment="Center" Foreground="Black" Margin="5,0,5,0"/>
                <StackPanel Orientation="Horizontal" Margin="5,0,5,0" HorizontalAlignment="Left" >
                    <TextBlock Text="Number of Satellites:" Width="155" VerticalAlignment="Stretch" Foreground="Black" Margin="5,5,5,0"/>
                    <ComboBox x:Name="NumberOfSatellites" SelectedIndex="0" ItemsSource="{Binding Path=NumberOfObjectsValues,Mode=OneTime}" SelectedItem="{Binding NumberOfObjects}" 
                              Height="auto" Width="75" Style="{StaticResource ComboStyle}" Margin="0,5,5,5"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Margin="5,0,5,0" HorizontalAlignment="Left" >
                    <TextBlock Text="Update speed (seconds):" Width="155" VerticalAlignment="Stretch" Foreground="Black" Margin="5,5,5,0"/>
                    <ComboBox x:Name="UpdateSpeed" SelectedIndex="0" ItemsSource="{Binding Path=UpdateSpeedValues,Mode=OneTime}" SelectedItem="{Binding UpdateSpeed}" 
                              Height="auto" Width="75" Style="{StaticResource ComboStyle}"  Margin="0,5,5,5"/>
                </StackPanel>

            </StackPanel>
        </Grid>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014