Viewing map problem in wpf

4457
3
02-06-2015 05:19 AM
TahaSözgen
New Contributor

Hi There;

I try to implement the solution described in Arcgis runtime sdk for .net. I try to implement ArcGISDynamicMapServiceLayer in the code examples. Here is the xaml code:

<Window x:Class="ArcGISDynamicMapServiceLayer.MainWindow"
   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/runtime/2013"
   Height="600" Width="800">
   <Grid>

   <!-- Add a MapView Control to the application. -->
   <esri:MapView>
   <!-- Add a Map. -->
   <esri:Map>
   <!-- Add an ArcGISDynamicMapServiceLayer via XAML. -->
   <esri:ArcGISDynamicMapServiceLayer ID="World Time Zones" 
   ServiceUri="http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer"/>
   </esri:Map>
   </esri:MapView>
   </Grid>

</Window>

Whenever I run this code in my machine, a window appears; however there is no map at all. What is the problem and how can I solve it?

Thanks in advance.

Tags (2)
0 Kudos
3 Replies
DominiqueBroux
Esri Frequent Contributor

As the service is cached at server side, I recommend you to use ArcGISTiledMapServiceLayer instead of ArcGISDynamicMapServiceLayer.

However this should work as well with an ArcGISDynamicMapServiceLayer so may be you run into another issue.

Let us know how it works with ArcGISTiledMapServiceLayer.

0 Kudos
TahaSözgen
New Contributor

It is not working again. I try to implement a basic, primitive desktop gis application. There is no ArcGISTiledMapServiceLayer in the ArcGIS Runtime SDK for .NET. Which concrete sample shall I use?

0 Kudos
TahaSözgen
New Contributor

I have used the code below, and it also doesn't show any map in the window:

<Window x:Class="Taskin_Uygulamasi.EditorSketching"
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/runtime/2013" 
    Title="MainWindow" Height="600" Width="800">

    <Grid x:Name="LayoutRoot">


        <!-- 
        Define a set of symbols that will be used in the code-behind to draw graphics on the screen. 
        -->
        <Grid.Resources>

            <esri:SimpleMarkerSymbol x:Key="MyPointSymbol" Color="Black" Size="12" Style="Circle" />

            <esri:SimpleLineSymbol x:Key="MyPolylineSymbol" Color="Green" Style="Solid" Width="1" />

            <esri:SimpleFillSymbol x:Key="MyPolygonSymbol" Color="Yellow" Style="Solid">
                <esri:SimpleFillSymbol.Outline>
                    <esri:SimpleLineSymbol Color="Black" Style="Solid" Width="2"/>
                </esri:SimpleFillSymbol.Outline>
            </esri:SimpleFillSymbol>

            <esri:SimpleFillSymbol x:Key="MyRectangleSymbol" Color="Turquoise" Style="DiagonalCross">
                <esri:SimpleFillSymbol.Outline>
                    <esri:SimpleLineSymbol Color="Pink" Style="Dash" Width="2"/>
                </esri:SimpleFillSymbol.Outline>
            </esri:SimpleFillSymbol>

            <esri:SimpleLineSymbol x:Key="MyFreehandSymbol" Color="Orange" Style="Dot" Width="4" />

            <esri:SimpleFillSymbol x:Key="MyArrowSymbol" Color="Blue" Style="Horizontal">
                <esri:SimpleFillSymbol.Outline>
                    <esri:SimpleLineSymbol Color="DarkGray" Style="Null" />
                </esri:SimpleFillSymbol.Outline>
            </esri:SimpleFillSymbol>

            <esri:SimpleFillSymbol x:Key="MyTriangleSymbol" Color="LightBlue" Style="Null">
                <esri:SimpleFillSymbol.Outline>
                    <esri:SimpleLineSymbol Color="Black" Style="DashDotDot"  Width="10"/>
                </esri:SimpleFillSymbol.Outline>
            </esri:SimpleFillSymbol>

            <esri:SimpleFillSymbol x:Key="MyEllipseSymbol" Color="White" Style="Solid">
                <esri:SimpleFillSymbol.Outline>
                    <esri:SimpleLineSymbol Color="Peru" Style="Solid" Width="5"/>
                </esri:SimpleFillSymbol.Outline>
            </esri:SimpleFillSymbol>

            <esri:SimpleFillSymbol x:Key="MyCircleSymbol" Color="Black" Style="Solid">
                <esri:SimpleFillSymbol.Outline>
                    <esri:SimpleLineSymbol Color="Red" Style="Solid" Width="2"/>
                </esri:SimpleFillSymbol.Outline>
            </esri:SimpleFillSymbol>

            <esri:SimpleLineSymbol x:Key="MyLineSegmentSymbol" Color="Aqua" Style="Solid" Width="4" />

        </Grid.Resources>

        <!-- Add a MapView Control. -->
        <esri:MapView x:Name="MapView1" Background="White" HorizontalAlignment="Left" Margin="10,112,0,0"  VerticalAlignment="Top" 
                   Height="447" Width="772">

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

                <!-- Add a backdrop ArcGISTiledMapServiceLayer. -->
                <esri:ArcGISTiledMapServiceLayer ID="World_Light_Gray_Base" 
                              ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer"/>

                <!-- Add an empty GraphicsLayer to hold graphics that are generated by the user with the Editor control. -->
                <esri:GraphicsLayer ID="MyGraphicsLayer"/>

            </esri:Map>
        </esri:MapView>

        <!-- Add a ComboBox to hold the different DrawShape enumerations that can be used for sketching graphics with the Editor control. -->
        <ComboBox Name="ComboxBox1" Height="40" Margin="199,67,407,462"/>

        <!-- Add a Button to begin the Editor.RequestShapeAsync() method based upon the user choice in the ComboBox. -->
        <Button Content="Draw Sketch" Height="40" HorizontalAlignment="Left" Margin="390,67,0,0" 
          Name="Button1" VerticalAlignment="Top" Width="184" Click="Button1_Click"/>


        <!-- Add a TextBlock to hold the instructions on how to use the sample code. -->
        <TextBlock Height="62" HorizontalAlignment="Left" Name="TextBlock1" VerticalAlignment="Top" Width="772" 
                   TextWrapping="Wrap" Margin="10,0,0,0" />
    </Grid>

</Window>

I am using ArcGISTiledMapServiceLayer and there is no map. How can I solve this problem?

0 Kudos