Stretch renderer

This sample demonstrates how to use stretch renderer on a raster layer.

Apply a stretch renderer to a raster layer


Choose a stretch renderer type from the dropdown listbox to change the settings for the stretch renderer. The sample allows you to change the stretch type and the parameters for each type. Click/tap the 'Update Renderer' button to update the raster. Experiment with settings for the various types for stretch parameters. For example, setting the renderer to use stretch parameters: Min Max with a min value of 50 and a max value of 200 will stretch between these pixel values. A higher min value will remove more of the lighter pixels values whilst a lower max will remove more of the darker. Percent Clip with a min value of 2 and a max value of 98 will stretch from 2% to 98% of the pixel values histogram. A lower min and higher max percentage will render using more of the original raster histogram. Standard Deviation with a factor of 2.0 will stretch 2 standard deviations from the mean. A higher factor (further from the mean) will render using more of the original raster histogram.


<UserControl x:Class="ArcGISRuntime.WPF.Samples.ChangeStretchRenderer.ChangeStretchRenderer"
             d:DesignHeight="300" d:DesignWidth="300">
        <esri:MapView x:Name="MyMapView" />
                Background="White" BorderBrush="Black" BorderThickness="1"
                HorizontalAlignment="Right" VerticalAlignment="Top"
                Margin="30" Width="375">
            <Grid Margin="20">
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                <TextBlock Text="Choose a stretch renderer type from the dropdown, adjust the parameter values, then click the 'Update Renderer' button." 
                           Margin="0,0,0,2" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" />
                <StackPanel Grid.Row="1">
                    <ComboBox x:Name="RendererTypes" Margin="10,5" SelectionChanged="RendererTypes_SelectionChanged"/>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock x:Name="Label_Parameter1" Text="Parameter1" Margin="10,5"></TextBlock>
                        <TextBox x:Name="Input_Parameter1" Text="EnterValue1" />
                    <StackPanel Orientation="Horizontal">
                        <TextBlock x:Name="Label_Parameter2"  Text="Parameter2" Margin="10, 5"></TextBlock>
                        <TextBox x:Name="Input_Parameter2" Text="EnterValue2"/>
                <Button x:Name="UpdateRenderer" Click="OnUpdateRendererClicked" Content="Update Renderer" Margin="10,10" Grid.Row="2"/>

In this topic
  1. Instructions
  2. Code