Reference to ListDataItem the mouse is over

2 posts, 1 answers
  1. Troy
    Troy avatar
    8 posts
    Member since:
    Sep 2010

    Posted 20 Oct 2013 Link to this post

    Is there a way to get the ListDataItem object that the mouse is hovering over in a RadListControl?
    I've been trying several approach's but been drawing a blank.  I'm thinking the item should already be available somehow since its being highlighted/formatted by the ListControl already...
    Thx
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 23 Oct 2013 Link to this post

    Hello Troy,

    Thank you for writing.

    Yes, there is a way to do that. Here is how to do it:
    void radListControl1_MouseHover(object sender, EventArgs e)
    {
        RadListVisualItem visualItem = radListControl1.ElementTree.GetElementAtPoint(radListControl1.PointToClient( MousePosition)) as RadListVisualItem;
     
        if (visualItem != null)
        {
            RadListDataItem dataItem = visualItem.Data;
        }
    }

    I hope this helps.

    Regards,
    Stefan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top