Stretch

This sample demonstrates how to apply an ESRI.ArcGIS.Client RenderingRule class on an ArcGISImageServiceLayer to display imagery in different stretch display formats. The stretch display types that are used for the stretch raster function include: None, Standard Deviation, Histogram, and MinMax. To use the sample, define input properties for the stretch raster function via the radio buttons and click Apply to see the changes.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.StretchImageService"
    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/client/2009"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.Resources>
            <LinearGradientBrush x:Key="PanelGradient" EndPoint="0.5,1" StartPoint="0.5,0">
                <LinearGradientBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterY="0.5" CenterX="0.5"/>
                        <SkewTransform CenterY="0.5" CenterX="0.5"/>
                        <RotateTransform Angle="176" CenterY="0.5" CenterX="0.5"/>
                        <TranslateTransform/>
                    </TransformGroup>
                </LinearGradientBrush.RelativeTransform>
                <GradientStop Color="#FF145787" Offset="0.16"/>
                <GradientStop Color="#FF3D7FAC" Offset="0.502"/>
                <GradientStop Color="#FF88C5EF" Offset="0.984"/>
            </LinearGradientBrush>
        </Grid.Resources>
        <esri:Map x:Name="MyMap" MinimumResolution="0.001">
            <esri:Map.Extent>
                <esri:Envelope XMin="-13483041.1159268" YMin="5707158.06847372" XMax="-13300798.7006729" YMax="5776035.73908334">
                    <esri:Envelope.SpatialReference>
                        <esri:SpatialReference WKID="102100"/>
                    </esri:Envelope.SpatialReference>
                </esri:Envelope>
            </esri:Map.Extent>
            <esri:ArcGISImageServiceLayer ID="ImageServiceLayer" 
                                          Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer" 
                                          ImageFormat="PNG8"
                                          NoData="0" InitializationFailed="Layer_InitializationFailed"/>
            <esri:ArcGISTiledMapServiceLayer Opacity="100" 
                    Url="http://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer" />
        </esri:Map>

        <Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,0" >
            <Rectangle Fill="{StaticResource PanelGradient}" Stroke="Gray"  RadiusX="10" RadiusY="10" Margin="0,0,0,5">
                <Rectangle.Effect>
                    <DropShadowEffect/>
                </Rectangle.Effect>
            </Rectangle>
            <Rectangle Fill="#FFFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="10,10,10,15" />
            <StackPanel Orientation="Vertical" Margin="30,20,20,30" >
                <TextBlock x:Name="ResponseTextBlock" Text="Define input properties for the stretch raster function.  Click Apply to apply the changes." 
                           Width="200" TextAlignment="Left"  TextWrapping="Wrap" Margin="0,0,0,5"  Foreground="Black"/>

                <StackPanel Orientation="Vertical">
                    <RadioButton x:Name="NoneCheckBox" Content="None" GroupName="StretchType" IsChecked="True"  Margin="3,0,0,0"/>
                    <RadioButton x:Name="StandardDevCheckBox" Content="Standard Deviation" GroupName="StretchType"  Margin="3,0,0,0"/>
                    <RadioButton x:Name="HistogramCheckBox" Content="Histogram" GroupName="StretchType" Margin="3,0,0,0" />
                    <RadioButton x:Name="MinMaxCheckBox" Content="MinMax" GroupName="StretchType"  Margin="3,0,0,0"/>
                    <StackPanel Orientation="Horizontal" Margin="3">
                        <TextBlock Text="Standard Deviations" VerticalAlignment="Center" Margin="3"  Foreground="Black" />
                        <TextBox x:Name="StnDevTextBox" Text="2" Width="20"  Foreground="Black"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="3">
                        <TextBlock Text="Band IDs" Margin="3" VerticalAlignment="Center"  Foreground="Black" />
                        <TextBox x:Name="BandIDsTextBox" Text="3,1,2" Width="50"  Foreground="Black"/>
                    </StackPanel>
                    <TextBlock x:Name="ValidBandIdsTextBlock" Text="3 bands must be defined" Foreground="Red" 
                                       Visibility="Collapsed" />
                </StackPanel>


                <Button Content="Apply" Margin="0,5,5,0" Click="ApplyButton_Click"  />
            </StackPanel>
        </Grid>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014