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.
Just as an aside, the control does not apply highlighting to the image intrinsically; my guess is you are using some variation of the 'Infragistics FileExplorer' sample to get that happening. You might want to just pull the line of code that sets the control's DrawFilter property, since if you are not using that, you can eliminate some unnecessary code execution.
i am still having the highlited focus rect when mouse down on the list for a few seconds
any idea why?
Hello Meir,
I`m not sure how to reproduce your issue. Are you able to upload small sample with your scenario and I`ll be glad to research it for you.
Let me know if you have any questions