ArcGISRuntimeXamarin.Samples.ChangeSublayerVisibility.ChangeSublayerVisibility.OnSublayersMenuItemClicked C# (CSharp) Method

OnSublayersMenuItemClicked() private method

private OnSublayersMenuItemClicked ( object sender, PopupMenu e ) : void
sender object
e PopupMenu
return void
        private void OnSublayersMenuItemClicked(object sender, PopupMenu.MenuItemClickEventArgs e)
        {
            // Change the checked value
            e.Item.SetChecked(!e.Item.IsChecked);

            // Get title from the selected item
            var selectedSublayerTitle = e.Item.TitleCondensedFormatted.ToString();

            // Get index that is used to get the selected url
            var sublayer = _imageLayer.Sublayers.First(x => x.Name == selectedSublayerTitle);
            sublayer.IsVisible = e.Item.IsChecked;
        }