Raster RGB renderer

This sample demonstrates how to use an RGB renderer on a raster layer. An RGB renderer is used to adjust the color bands of a multi-spectral image.

Apply an RGB stretch renderer

Instructions

Choose one of the stretch parameter types. The other options will adjust based on the chosen type. Add your inputs and press the Apply button to update the renderer.

Code

<UserControl x:Class="ArcGISRuntime.WPF.Samples.RasterRgbRenderer.RasterRgbRenderer"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
    <Grid>
        <esri:MapView x:Name="MyMapView" />
        <Border Background="White" BorderBrush="Black" BorderThickness="1"
                HorizontalAlignment="Right" VerticalAlignment="Top"
                Margin="10" Padding="10"
                Width="360">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4"
                            Orientation="Horizontal">
                    <TextBlock Text="Stretch type: " 
                           HorizontalAlignment="Right" VerticalAlignment="Center"
                           Margin="0,0,3,0"/>
                    <ComboBox x:Name="StretchTypeComboBox"
                              Width="240"
                              SelectionChanged="StretchTypeComboBox_SelectionChanged"/>
                </StackPanel>
                <Grid x:Name="MinMaxParametersGrid"
                      Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4"
                      Margin="0,10"
                      Visibility="Visible">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Row="0" Grid.Column="0"
                           Text="Min value: " 
                           HorizontalAlignment="Right" VerticalAlignment="Center"
                           Margin="0,0,3,0"/>
                    <ComboBox x:Name="MinRedComboBox"
                             Grid.Row="0" Grid.Column="1"
                             Foreground="Red"
                             Width="50"
                             HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Right"/>
                    <ComboBox x:Name="MinGreenComboBox"
                             Grid.Row="0" Grid.Column="2"
                             Foreground="Green"
                             Width="50"
                             HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Right"/>
                    <ComboBox x:Name="MinBlueComboBox"
                             Grid.Row="0" Grid.Column="3"
                             Foreground="Blue"
                             Width="50"
                             HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Right"/>
                    <TextBlock Grid.Row="1" Grid.Column="0"
                           Text="Max value: " 
                           HorizontalAlignment="Right" VerticalAlignment="Center"
                           Margin="0,0,3,0"/>
                    <ComboBox x:Name="MaxRedComboBox"
                             Grid.Row="1" Grid.Column="1"
                             Foreground="Red"
                             Width="50"
                             HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Right"/>
                    <ComboBox x:Name="MaxGreenComboBox"
                             Grid.Row="1" Grid.Column="2"
                             Foreground="Green"
                             Width="50"
                             HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Right"/>
                    <ComboBox x:Name="MaxBlueComboBox"
                             Grid.Row="1" Grid.Column="3"
                             Foreground="Blue"
                             Width="50"
                             HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Right"/>
                </Grid>
                <Grid x:Name="PercentClipParametersGrid"
                      Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4"
                      Visibility="Hidden">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="3*"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Row="0" Grid.Column="0"
                               Text="Minimum %: "
                               HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    <Slider x:Name="MinimumValueSlider"
                            Grid.Row="0" Grid.Column="1"
                            VerticalAlignment="Center"
                            Minimum="0" Maximum="100"/>
                    <TextBlock Grid.Row="1" Grid.Column="0"
                               Text="Maximum %: "
                               HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    <Slider x:Name="MaximumValueSlider"
                            Grid.Row="1" Grid.Column="1"
                            VerticalAlignment="Center"
                            Minimum="0" Maximum="100"/>                    
                </Grid>
                <Grid x:Name="StdDeviationParametersGrid"
                      Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4"
                      Visibility="Hidden">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="3*"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Row="0" Grid.Column="0"
                               Text="Factor: "
                               HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    <ComboBox x:Name="StdDeviationFactorComboBox"
                              Grid.Row="0" Grid.Column="1"
                              Width="60"
                              VerticalAlignment="Center" HorizontalAlignment="Left"/>
                </Grid>
                <Button x:Name="ApplyRgbRendererButton"
                        Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2"
                        Margin="0,5"
                        IsEnabled="False"
                        Content="Apply renderer"
                        Click="ApplyRgbRendererButton_Click"/>
            </Grid>
        </Border>
    </Grid>
</UserControl>


In this topic
  1. Instructions
  2. Code