private void ShowSearchMapUI()
        {
            if (_searchMapsUI != null)
            {
                return;
            }

            // Create a view to show map item info entry controls over the map view
            var ovBounds = new CoreGraphics.CGRect(0, 60, View.Bounds.Width, View.Bounds.Height - 60);

            _searchMapsUI = new SearchMapsDialogOverlay(ovBounds, 0.75f, UIColor.White);

            // Handle the OnSearchMapsTextEntered event to get the info entered by the user
            _searchMapsUI.OnSearchMapsTextEntered += SearchTextEntered;

            // Handle the cancel event when the user closes the dialog without choosing to search
            _searchMapsUI.OnCanceled += SearchCanceled;

            // Add the search UI view (will display semi-transparent over the map view)
            View.Add(_searchMapsUI);
        }
        // Handle the SearchTextEntered event from the search input UI
        // SearchMapsEventArgs contains the search text that was entered
        private async void SearchTextEntered(object sender, SearchMapsEventArgs e)
        {
            try
            {
                // Get web map portal items from a keyword search
                IEnumerable <PortalItem> mapItems = null;
                ArcGISPortal             portal;

                // Connect to the portal (anonymously)
                portal = await ArcGISPortal.CreateAsync(new Uri(ServerUrl));

                // Create a query expression that will get public items of type 'web map' with the keyword(s) in the items tags
                var queryExpression = string.Format("tags:\"{0}\" access:public type: (\"web map\" NOT \"web mapping application\")", e.SearchText);

                // Create a query parameters object with the expression and a limit of 10 results
                PortalQueryParameters queryParams = new PortalQueryParameters(queryExpression, 10);

                // Search the portal using the query parameters and await the results
                PortalQueryResultSet <PortalItem> findResult = await portal.FindItemsAsync(queryParams);

                // Get the items from the query results
                mapItems = findResult.Results;

                // Show the map results
                ShowMapList(mapItems);
            }
            catch (Exception ex)
            {
                // Report search error
                UIAlertController alert = UIAlertController.Create("Error", ex.Message, UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
                PresentViewController(alert, true, null);
            }
            finally
            {
                // Get rid of the search input controls
                _searchMapsUI.Hide();
                _searchMapsUI = null;
            }
        }
 private void SearchCanceled(object sender, EventArgs e)
 {
     // Remove the search input UI
     _searchMapsUI.Hide();
     _searchMapsUI = null;
 }