Click or drag to resize

Scene Constructor (Item)

Initializes a new instance of the Scene class with an ArcGIS Item.

Namespace:  Esri.ArcGISRuntime.Mapping
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.11.0
Syntax
public Scene(
	Item item
)

Parameters

item
Type: Esri.ArcGISRuntime.PortalItem
The webscene item. Only PortalItem is supported.
Remarks
The specified item must be of type WebScene or the scene will fail to load
Examples

WPF

Example Name: OpenScenePortalItem

Open a web scene from a portal item.

Code example screen shot.

C#
// 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: http://www.apache.org/licenses/LICENSE-2.0
// 
// 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 Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Portal;
using System;
using System.Windows;

namespace ArcGISRuntime.WPF.Samples.OpenScenePortalItem
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        name: "Open scene (portal item)",
        category: "Scene",
        description: "Open a web scene from a portal item.",
        instructions: "When the sample opens, it will automatically display the scene from ArcGIS Online. Pan and zoom to explore the scene.",
        tags: new[] { "portal", "scene", "web scene" })]
    public partial class OpenScenePortalItem
    {
        // Hold the ID of the portal item, which is a web scene.
        private const string ItemId = "31874da8a16d45bfbc1273422f772270";

        public OpenScenePortalItem()
        {
            InitializeComponent();

            // Create the UI, setup the control references and execute initialization.
            Initialize();
        }

        private async void Initialize()
        {
            try
            {
                // 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)
            {
                MessageBox.Show(e.ToString(), "Error");
            }
        }
    }
}
XAML
<UserControl
    x:Class="ArcGISRuntime.WPF.Samples.OpenScenePortalItem.OpenScenePortalItem"
    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">
    <Grid>
        <esri:SceneView x:Name="MySceneView" />
    </Grid>
</UserControl>
See Also
Additional Examples
Hyperlink to ExampleDescription
OpenScenePortalItemOpen a web scene from a portal item.
ViewContentBeneathSurfaceSee through terrain in a scene and move the camera underground.