2 posts, 0 answers
  1. Philip
    Philip avatar
    7 posts
    Member since:
    Sep 2012

    Posted 20 Sep 2013 Link to this post

    I want to create a custom control (C#) inherited from RadListControl so that my new control will have a click event for the list's items (not the control itself - since, undesirably, the scroll bar triggers the control's event).

    Which control event can I override so I can subscribe to the item's double-click event?  I expected an item_added or similar event but don't see one.

    I can do this (but it is ugly and doesn't handle new items being added later):
    foreach (RadListDataItem item in this.RadListControl1.Items) {
        item.VisualItem.DoubleClick += Item_DoubleClick;

    private void Item_DoubleClick(object sender, EventArgs e)
        RadListDataItem item = ((RadListVisualItem)sender).Data;
  2. Dimitar
    Dimitar avatar
    1337 posts

    Posted 25 Sep 2013 Link to this post

    Hello Philip,

    Thank you for contacting us.

    First I want to say that the VisualItem property should be used only to get information about a particular item. This property will return null when the item is not visible. Also bear in mind that the visual items are shared among different data items.

    To achieve the desired functionality you can override the OnDoubleClick method. Here is sample implementation of a class that inherits RadListControl and uses the code to display the clicked item text:
    public class MyListControl : RadListControl
        protected virtual void ElementDoubleClick(object sender, MouseEventArgs e)
            RadListDataItem item = ((RadListVisualItem)sender).Data;
        protected override void OnDoubleClick(EventArgs e)
            MouseEventArgs args = (MouseEventArgs)e;
            var element = this.ElementTree.GetElementAtPoint(new Point(args.X, args.Y));
            this.ElementDoubleClick(element, args);

    I hope this will be useful. Should you have further questions, I would be glad to help.

    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. DevCraft banner
Back to Top