Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
335
Hide Focus Rectangle on Text of UltraListViewItem
posted

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?

Parents
  • 69832
    Verified Answer
    Offline posted

    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 NoFocusRectDrawFilter
    public 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

        #endregion
    }
    #endregion NoFocusRectDrawFilter

Reply Children