ArcGISRuntimeXamarin.Samples.FeatureCollectionLayerFromPortal.FeatureCollectionLayerFromPortal.CreateLayout C# (CSharp) Méthode

CreateLayout() private méthode

private CreateLayout ( ) : void
Résultat void
        private void CreateLayout()
        {
            // Store the main view's width and height
            var appViewWidth = View.Bounds.Width;
            var appViewHeight = View.Bounds.Height;

            // Define an offset from the top of the page (to account for the iOS status bar)
            var yPageOffset = 60;

            // Define the bottom of the map view (accommodate for additional controls below)
            var bottom = appViewHeight - yPageOffset - 80;

            // Create a new MapView
            _myMapView = new MapView();

            // Setup the visual frame for the MapView
            var mapViewFrame = new CoreGraphics.CGRect(0, yPageOffset, appViewWidth, bottom);
            _myMapView.Frame = mapViewFrame;

            // Create a text input for the portal item Id
            bottom += 70;
            var textInputFrame = new CoreGraphics.CGRect(10, bottom, appViewWidth - 10, 20);
            _collectionItemIdTextBox = new UITextField(textInputFrame);
            _collectionItemIdTextBox.BackgroundColor = UIColor.LightGray;

            // Create a button for adding features from a portal item
            bottom += 30;
            var buttonFrame = new CoreGraphics.CGRect(0, bottom, appViewWidth, 30);
            UIButton addFeaturesButton = new UIButton(UIButtonType.Custom)
            {
                Frame = buttonFrame,
                BackgroundColor = UIColor.White
            };
            addFeaturesButton.SetTitle("Add from portal item", UIControlState.Normal);
            addFeaturesButton.SetTitleColor(UIColor.Blue, UIControlState.Normal);

            // Assign a click handler to the UIButton
            addFeaturesButton.TouchUpInside += OpenPortalFeatureCollectionClick;

            // Add the MapView, UITextField, and UIButton to the page
            View.AddSubviews(_myMapView, _collectionItemIdTextBox, addFeaturesButton);
            View.BackgroundColor = UIColor.White;
        }
    }