ArcGIS Runtime SDK for .NET Samples

Open scene (Portal item)

Open a scene from a portal item

// Copyright 2018 Esri.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific 
// language governing permissions and limitations under the License.

using Android.App;
using Android.OS;
using Android.Widget;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Portal;
using Esri.ArcGISRuntime.UI.Controls;
using System;

namespace ArcGISRuntime.Samples.OpenScene
        "Open scene (Portal item)",
        "This sample demonstrates how to open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal.",
        "The sample will load the scene automatically.")]
    public class OpenScene : Activity
        // Hold the ID of the portal item, which is a web scene.
        private const string ItemId = "a13c3c3540144967bc933cb5e498b8e4";

        // Create the scene view.
        private readonly SceneView _mySceneView = new SceneView();

        protected override void OnCreate(Bundle bundle)

            Title = "Open scene (Portal item)";

            // Create the UI, setup the control references and execute initialization 

        private async void Initialize()
                // Try to load the default portal, which will be ArcGIS Online.
                ArcGISPortal portal = await ArcGISPortal.CreateAsync();

                // Create the portal item.
                PortalItem websceneItem = await PortalItem.CreateAsync(portal, ItemId);

                // Create and show the scene.
                _mySceneView.Scene = new Scene(websceneItem);
            catch (Exception e)

        private void CreateLayout()
            // Create a new vertical layout for the app
            var layout = new LinearLayout(this) {Orientation = Orientation.Vertical};

            // Add the map view to the layout

            // Show the layout in the app

In this topic
  1. Code