IRasterStretchColorRampRenderer question

Discussion created by dbrandon on Nov 9, 2012

I have a stand alone application written in C# that tries to set a renderer for a raster image that is being created.  Basically, the code is very simple and looks something along the lines of:

 // Customize how the raster renders.
 IRasterStretchColorRampRenderer mRenderer = new RasterStretchColorRampRenderer();
 mRenderer.ColorScheme = "Blue Light to Dark";

// Code to generate the raster here...

// Create the raster layer and set the renderer.
m_rasLayer.Renderer = (IRasterRenderer)mRenderer;

// Add the layer to the last position in the table of contents.
m_hookHelper.FocusMap.MoveLayer(rasLayer, map.LayerCount - 1);
activeView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);

Furthermore, in the application, the user can select the raster layer and change the sybology through a dialog.  It has a similar way of setting the raster renderer...

// A method that returns a valid renderer.
IRasterStretchColorRampRenderer rasterStretchRenderer = myFramework.symbolForm.GetRasterStretchRenderer(rasterLayer);

if(rasterStretchRenderer == null)

// Set the renderer.
rasterLayer.Renderer = (IRasterRenderer)rasterStretchRenderer;

In both instances, the IRasterStretchColorRampRenderer holds the values I expect to see right before the call to set the renderer, i.e. rasterLayer.Renderer = (IRasterRenderer)rasterStretchRenderer;

However, the moment that call is made, the values are blown away and the default black to white renderer is displayed in the map.  Any idea why this would be happening?