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

Prevent Drag on GridSplitter

1 Answer 191 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
GuillaumeR
Top achievements
Rank 1
GuillaumeR asked on 22 Jun 2010, 03:45 PM
Hello,

Is it possible to prevent drag operation when an user is using a GridSplitter to resize column/row ?

For example :



        <telerik:RadTreeView IsDragDropEnabled="True" ItemTemplate="{StaticResource TreeItemTemplate}">  
            <telerik:RadTreeView.ItemContainerStyle> 
                <Style TargetType="{x:Type telerik:RadTreeViewItem}">  
                    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>  
                </Style> 
            </telerik:RadTreeView.ItemContainerStyle> 
            <telerik:RadTreeView.Items> 
                <Control Name="control1" Tag="Some text for control1" /> 
                <Control Name="control2" Tag="Some text for control2" /> 
            </telerik:RadTreeView.Items> 
        </telerik:RadTreeView> 
 
            <DataTemplate x:Key="TreeItemTemplate">  
                <Border BorderThickness="1" BorderBrush="LightGray" Margin="2" CornerRadius="5">  
                    <Grid> 
                        <Grid.ColumnDefinitions> 
                            <ColumnDefinition Width="Auto"/>  
                            <ColumnDefinition Width="*"/>  
                        </Grid.ColumnDefinitions> 
                        <TextBlock Grid.Column="0" Text="{Binding Name}" Margin="3,0,10,0"/>  
                        <GridSplitter Grid.Column="0" Width="1" Background="LightGray" ResizeDirection="Columns"/>  
                        <TextBlock Grid.Column="1" Text="{Binding Tag}" Margin="3,0,0,0"/>  
                    </Grid> 
                </Border> 
            </DataTemplate> 
 

Is there any solution ? I tried t define  dragDrop:RadDragAndDropManager.AllowDrag="False" on GridSplitter but this doesn't work.

I have the same problem using RadDragDropManager in a templated list (Some draggable items contain Slider).

Thanks,
Guillaume.

1 Answer, 1 is accepted

Sort by
0
GuillaumeR
Top achievements
Rank 1
answered on 25 Jun 2010, 08:30 AM
Hello,

I found a solution :

<GridSplitter Grid.Column="0" Width="1" Background="LightGray" ResizeDirection="Columns" dragDrop:RadDragAndDropManager.AllowDrag="True" dragDrop:RadDragAndDropManager.DragQuery="GridSplitter_DragQuery"/>  
 

        private void GridSplitter_DragQuery(object sender, Telerik.Windows.Controls.DragDrop.DragDropQueryEventArgs e)  
        {  
            e.QueryResult = false;  
            e.Handled = true;  
        }  
 

Thanks,
Guillaume.
Tags
DragAndDrop
Asked by
GuillaumeR
Top achievements
Rank 1
Answers by
GuillaumeR
Top achievements
Rank 1
Share this question
or