private void OnUpdateRendererClicked(object sender, EventArgs e)
        {
            // This function acquires the user selection of the stretch renderer from the table view
            // along with the parameters specified, then a stretch renderer is created and applied to
            // the raster layer

            // Get the user choice for the raster stretch render
            UITableViewSource myUITableViewSource = _myRenderChoiceType.Source;
            TableSource       myTableSource       = (TableSource)myUITableViewSource;
            string            myRendererTypeChoice;

            if (myTableSource.SelectedValue == null)
            {
                // If the user does not click on a choice in the table but just clicks the
                // button, the selected value will be null so use the initial
                // stretch renderer option
                myRendererTypeChoice = "Min Max";
            }
            else
            {
                // The user clicked on an option in the table and thus the selected value
                // will contain a valid choice
                myRendererTypeChoice = myTableSource.SelectedValue;
            }

            // Create an IEnumerable from an empty list of doubles for the gamma values in the stretch render
            IEnumerable <double> myGammaValues = new List <double> {
            };

            // Create a color ramp for the stretch renderer
            ColorRamp myColorRamp = ColorRamp.Create(PresetColorRampType.DemLight, 1000);

            // Create the place holder for the stretch renderer
            StretchRenderer myStretchRenderer = null;

            switch (myRendererTypeChoice)
            {
            case "Min Max":

                // This section creates a stretch renderer based on a MinMaxStretchParameters
                // TODO: Add you own logic to ensure that accurate min/max stretch values are used

                // Create an IEnumerable from a list of double min stretch value doubles
                IEnumerable <double> myMinValues = new List <double> {
                    Convert.ToDouble(_Input_Parameter1.Text)
                };

                // Create an IEnumerable from a list of double max stretch value doubles
                IEnumerable <double> myMaxValues = new List <double> {
                    Convert.ToDouble(_Input_Parameter2.Text)
                };

                // Create a new MinMaxStretchParameters based on the user choice for min and max stretch values
                MinMaxStretchParameters myMinMaxStretchParameters = new MinMaxStretchParameters(myMinValues, myMaxValues);

                // Create the stretch renderer based on the user defined min/max stretch values, empty gamma values, statistic estimates, and a predefined color ramp
                myStretchRenderer = new StretchRenderer(myMinMaxStretchParameters, myGammaValues, true, myColorRamp);

                break;

            case "Percent Clip":

                // This section creates a stretch renderer based on a PercentClipStretchParameters
                // TODO: Add you own logic to ensure that accurate min/max percent clip values are used

                // Create a new PercentClipStretchParameters based on the user choice for min and max percent clip values
                PercentClipStretchParameters myPercentClipStretchParameters = new PercentClipStretchParameters(Convert.ToDouble(_Input_Parameter1.Text), Convert.ToDouble(_Input_Parameter2.Text));

                // Create the percent clip renderer based on the user defined min/max percent clip values, empty gamma values, statistic estimates, and a predefined color ramp
                myStretchRenderer = new StretchRenderer(myPercentClipStretchParameters, myGammaValues, true, myColorRamp);

                break;

            case "Standard Deviation":

                // This section creates a stretch renderer based on a StandardDeviationStretchParameters
                // TODO: Add you own logic to ensure that an accurate standard deviation value is used

                // Create a new StandardDeviationStretchParameters based on the user choice for standard deviation value
                StandardDeviationStretchParameters myStandardDeviationStretchParameters = new StandardDeviationStretchParameters(Convert.ToDouble(_Input_Parameter1.Text));

                // Create the standard deviation renderer based on the user defined standard deviation value, empty gamma values, statistic estimates, and a predefined color ramp
                myStretchRenderer = new StretchRenderer(myStandardDeviationStretchParameters, myGammaValues, true, myColorRamp);

                break;
            }

            // Get the existing raster layer in the map
            RasterLayer myRasterLayer = (RasterLayer)_myMapView.Map.OperationalLayers[0];

            // Apply the stretch renderer to the raster layer
            myRasterLayer.Renderer = myStretchRenderer;
        }
        public void RenderChoiceSelectionChanged(int selectedIndex)
        {
            // This function modifies the UI parameter controls depending on which stretch
            // renderer is chosen by the user when clicking the table view

            // Get the user choice for the raster stretch render
            UITableViewSource myUITableViewSource  = _myRenderChoiceType.Source;
            TableSource       myTableSource        = (TableSource)myUITableViewSource;
            string            myRendererTypeChoice = myTableSource.TableItems[selectedIndex];

            switch (myRendererTypeChoice)
            {
            case "Min Max":

                // This section displays/resets the user choice options for MinMaxStretchParameters

                // Make sure all the GUI items are visible
                _Label_Parameter1.Hidden = false;
                _Label_Parameter2.Hidden = false;
                _Input_Parameter1.Hidden = false;
                _Input_Parameter2.Hidden = false;

                // Define what values/options the user sees
                _Label_Parameter1.Text = "Minimum value (0 - 255):";
                _Label_Parameter2.Text = "Maximum value (0 - 255):";
                _Input_Parameter1.Text = "10";
                _Input_Parameter2.Text = "150";

                break;

            case "Percent Clip":

                // This section displays/resets the user choice options for PercentClipStretchParameters

                // Make sure all the GUI items are visible
                _Label_Parameter1.Hidden = false;
                _Label_Parameter2.Hidden = false;
                _Input_Parameter1.Hidden = false;
                _Input_Parameter2.Hidden = false;

                // Define what values/options the user sees
                _Label_Parameter1.Text = "Minimum (0 - 100):";
                _Label_Parameter2.Text = "Maximum (0 - 100)";
                _Input_Parameter1.Text = "0";
                _Input_Parameter2.Text = "50";

                break;

            case "Standard Deviation":

                // This section displays/resets the user choice options for StandardDeviationStretchParameters

                // Make sure that only the necessary GUI items are visible
                _Label_Parameter1.Hidden = false;
                _Label_Parameter2.Hidden = true;
                _Input_Parameter1.Hidden = false;
                _Input_Parameter2.Hidden = true;

                // Define what values/options the user sees
                _Label_Parameter1.Text = "Factor (.25 to 4):";
                _Input_Parameter1.Text = "0.5";

                break;
            }
        }