I'm trying to create an image selector using the UltraListView. I create the UltraListViewItem, set the image, and leave the text blank. Unfortunately the focus rectangle will still show on the text when the item is active even though there is no text. Is there a way to have the text area be unnoticeable when selected?
You can use the IUIElementDrawFilter interface to hide the focus rectangle. You would also, however, have to make the selected background color transparent; the following code sample demonstrates how to do this:
using Infragistics.Win;
this.lvwFiles.DrawFilter = new NoFocusRectDrawFilter();this.lvwFiles.ItemSettings.SelectedAppearance.BackColor = Color.Transparent;
#region NoFocusRectDrawFilterpublic class NoFocusRectDrawFilter : IUIElementDrawFilter{
#region IUIElementDrawFilter Members
bool IUIElementDrawFilter.DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { return drawPhase == DrawPhase.BeforeDrawFocus; }
DrawPhase IUIElementDrawFilter.GetPhasesToFilter(ref UIElementDrawParams drawParams) { return DrawPhase.BeforeDrawFocus; }
#endregion}#endregion NoFocusRectDrawFilter
Worked like a charm, thanks. I made one change, I used:lvIcons.ItemSettings.SelectedAppearance.BackColorAlpha = Alpha.Transparent;
The other line hides the highlighting on the image too. This worked better for me.