This is a migrated thread and some comments may be shown as answers.

RadTreeView Drag Handlers??

1 Answer 50 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 2
Kevin asked on 28 Jul 2010, 11:53 AM

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

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 29 Jul 2010, 04:28 PM
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
Asked by
Top achievements
Rank 2
Answers by
Telerik team
Share this question