Note that the Infragistics.Win.Appearance object exposes properties like ForeColorDisabled and BackColorDisabled so that you can customize the way disabled items look. There is, however, no property through which you can assign an image that is displayed only when the item is disabled.
The following code sample demonstrates how to make the images displayed by UltraListViewItems always look enabled, regardless of the associated item's enambed state:
this.listView.CreationFilter = new DisabledImageCreationFilter();
private class DisabledImageCreationFilter : IUIElementCreationFilter
{
#region IUIElementCreationFilter Members
void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent)
{
if ( parent is UltraListViewItemEditorAreaUIElement )
{
ImageUIElement imageElement = parent.GetDescendant( typeof(ImageUIElement) ) as ImageUIElement;
if ( imageElement != null )
{
UIElementsCollection childElements = imageElement.Parent.ChildElements;
AlwaysEnabledImageUIElement newElement = new AlwaysEnabledImageUIElement( parent, imageElement.Image );
newElement.Rect = imageElement.Rect;
childElements.Remove( imageElement );
childElements.Add( newElement );
}
}
}
bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement parent)
{
return false;
}
#endregion
private class AlwaysEnabledImageUIElement : ImageUIElement
{
public AlwaysEnabledImageUIElement( UIElement parent, Image image ) : base( parent, image ){}
public override bool Enabled
{
get
{
return true;
}
set
{
throw new NotSupportedException();
}
}
}
}