How do i stop Drag Select on Themed Data Grid ?

Editors for WPF Forum

Posted 8 years ago by Muds
Version: 16.1.0663
Avatar

Library Version - 16.1.633.0

 

 

Hi All

I am trying to build an application that uses ThemedDataGrid and supports drag drop of single and multiple rows.

So in order to do that i want users to be able to select multiple rows using ctrl/shift keys but not drag select because as soon as user tries to drag the item, the grid starts to multiselect it.

can i simply stop this drag select feature of the ThemedDataGrid ?

Comments (4)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

The open source DataGrid add-on we provide just has some extensions for the native WPF DataGrid.  Could you tell us exactly how to repro this scenario in one of our samples so that we can see what you mean, and whether it's something that would need to change in our code or in the native WPF DataGrid?


Actipro Software Support

Posted 8 years ago by Muds
Avatar

Hi

Its thee simplest case --

 

XAML Code

<Window x:Class="ActiproDragSelectSample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:datagrid="http://schemas.actiprosoftware.com/winfx/xaml/datagrid"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <datagrid:ThemedDataGrid ItemsSource="{Binding Items}">
            <DataGrid.Columns>
                <DataGridTextColumn Width="Auto"
                                        Binding="{Binding Path=.}"
                                        Header="Name" />
            </DataGrid.Columns>
        </datagrid:ThemedDataGrid>
    </Grid>
</Window>

 c# code

using System.Collections.ObjectModel;
using System.Windows;

namespace ActiproDragSelectSample
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            this.DataContext = this;
            Items = new ObservableCollection<string>();
            Items.Add("Hi");
            Items.Add("Hello");
            Items.Add("1");
            Items.Add("2");
            Items.Add("3");
            Items.Add("4");
            Items.Add("5");
            Items.Add("6");
            Items.Add("7");

            InitializeComponent();
        }

        public ObservableCollection<string> Items { get; set; }
    }
}

 

in this example, if you mouse down on row  and move your mouse to rows below, it selects all the rows, i want to stop this behaviour.

it should only select when shift or ctrol keys are pressed that too on click not on mouse move.

 

selection on mouse move makes drag drop impossible.

 

Thanks

Regards

Mudit M.

Posted 8 years ago by Muds
Avatar

hi

 

any solution that you can suggest ?

 

Thanks

Regards

M.

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello, in our last post we suggested possibly overriding OnMouseMove since that's where most of Microsoft's logic for this seems to be.  If you use Reflector, you can browse it and see for yourself.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.