Click or drag to resize
Code Example - GeoRSSLayerWindow

Creates a GeoRssLayer based on the United States Geological Survey earthquake feed and assigned a SimpleRenderer.

Code Example
GeoRSSLayer Window

This section contains selected code files from a Visual Studio project that emphasize specific ArcGIS Runtime SDK (Windows Desktop) features. For example: some code examples may accomplish the bulk of the work as a configuration property in the .xaml file and hence only the .xaml file will be shown in detail below. In other code examples, the .xaml is used to define the configuration of graphical elements for the application but the application logic is performed in the code behind, hence you may see both the .xaml and .cs/.vb files shown in detail below.

<Window x:Class="GeoRSSLayerWindow.MainWindow"
        Height="600" Width="800"
        Tag="GeoRSSLayerWindow" >


            <!-- Create a custom SimpleMarkerSymbol earthquake locations. -->
            <esri:SimpleRenderer x:Key="MySimpleRenderer">
                <esri:SimpleMarkerSymbol Color="#FF0A57FC" Size="12" Style="Triangle" />


        <!-- Add a MapView Control. Set the WrapAround mode to True so that map can pan around continuously. -->
        <esri:MapView x:Name="MapView1" WrapAround="True">

            <!-- Add a Map. -->
            <esri:Map  x:Name="MyMap">

                <!-- Add a backdrop ArcGISTiledMapServiceLayer. -->
                    ServiceUri="" />

                <!-- Add a GeoRssLayer. A custom SimpleRenderer is applied based on the settings in the XAML file 
                in the Grid.Resources section. -->
                <esri:GeoRssLayer ID="MyGeoRssLayer" Renderer="{StaticResource MySimpleRenderer}"
                                  ServiceUri=""  />

        <StackPanel Width="300" HorizontalAlignment="Right" VerticalAlignment="Top" Background="Black"

            <!-- Add a button for the user to manually refresh the GeoRssLayer data feed. -->
            <Button Margin="3" Content="Update" Click="OnLayerUpdateButtonClick"/>

            <!-- Textbox to display a message if the GeoRssLayer data feed refresh was successful. -->
            <TextBlock x:Name="OutputTextBox" Foreground="White"/>



SPECIAL NOTE: The XAML displayed above comes from a C# project. If you are a VB.NET developer, you will need to modify the text for the x:Class namespace from "GeoRSSLayerWindow.MainWindow" to be just "MainWindow".

// NOTE: Creates a GeoRssLayer based on the United States Geological Survey earthquake feed and assigned 
// a SimpleRenderer.

namespace GeoRSSLayerWindow
    public partial class MainWindow : System.Windows.Window
        public MainWindow()


        private async void Init()
            var layer = MapView1.Map.Layers["MyGeoRssLayer"];
            await layer.InitializeAsync();


        private async void OnLayerUpdateButtonClick(object sender, System.Windows.RoutedEventArgs e)

                // Clear out any existing messages to the user.
                OutputTextBox.Text = "";

                // Get the GeoRssLayer from the Map. The GeoRssLayer was previously added in the Xaml.
                Esri.ArcGISRuntime.Layers.GeoRssLayer myGeoRssLayer = null;
                myGeoRssLayer = MapView1.Map.Layers[1] as Esri.ArcGISRuntime.Layers.GeoRssLayer;

                // Ensure we have a something for the GeoRssLayer
                if (myGeoRssLayer != null)

                    // Reload the information about the GeoRssLayer from the feed source.
                    await myGeoRssLayer.UpdateAsync();

                    // Display a message to the user that the GeoRssLayer was updated successfully.
                    OutputTextBox.Text = "The GeoRssLayer was updated successfully.";


            catch (System.Exception ex)

                // There was some problem with the application. Provide details to the user.