RadTreeView Drag Handlers??

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    83 posts
    Member since:
    Sep 2008

    Posted 28 Jul 2010 Link to this post


    not sure if this is something thats possible, but is it possible to make only certain parts of an item "Draggable"... having an area / control that is the drag point of the control... see exampeitem imaeg for the kinda of area i'm talking about on my control..

    Hope this makes sense.

    Cheers guys
  2. Miroslav
    Miroslav avatar
    922 posts

    Posted 29 Jul 2010 Link to this post

    Hello Kevin,

    Yes, you can achieve this. You can handle the DragQuery event and allow the drag only if the mouse is above a certain element in the ItemTemplate, e.g.;

    private void OnDragQuery(object sender, DragDropQueryEventArgs e)
        var sourceItem = e.Options.Source as RadTreeViewItem;
        // Allow dragging from the drag handle only:
        if (e.QueryResult == true
            && sourceItem != null
            && e.Options.Status == DragStatus.DragQuery)
            var dragHandle = sourceItem.FindChildByType<Button>();
            e.QueryResult = dragHandle.IsMouseOver;

    Where you register for the event like so:

        new EventHandler<DragDropQueryEventArgs>(OnDragQuery), true);

    And the ItemTemplate is:

    <telerik:HierarchicalDataTemplate ItemsSource="{Binding ChildCategories}">
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            <Button Content="|||" x:Name="dragHandle" />
            <TextBlock Text="{Binding Title}" 
                       Grid.Column="1" Margin="4 2 2 2" 

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top