BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
void sfdatagrid_MouseMove(object sender, MouseEventArgs e)
if (e.MouseDevice.LeftButton == MouseButtonState.Pressed)
//With the help of VisualContainer ,you can get the row and column index based on the mouse move pointer position
var visualcontainer = this.sfdatagrid.GetVisualContainer();
// Gets the exact position where the mouse pointer is moved
var point = e.GetPosition(visualcontainer);
//Here you can get the row and column index based on the pointer position by using PointToCellRowColumnIndex() method
var rowColumnIndex = visualcontainer.PointToCellRowColumnIndex(point);
//When the rowindex is zero , the row will be header row
var data = this.sfdatagrid.GetRowGenerator().Items.FirstOrDefault(x => x.RowIndex == rowColumnIndex.RowIndex);
sfdatagrid.Dispatcher.BeginInvoke(new Action(() =>
sfdatagrid.SelectedItem = data.RowData;
I've searched a lot inside the forum before to write.
I need to disable the selection when the left mouse button is down and the mouse is dragged.
Is it possible to do it in an SfDataGrid?
The result that I want to achieve is that the user can select rows by mouse click and at least with the combination mouse click + the shift key.
This feature that I discover by a friend is a danger for certain type of users
this.sfGrid.SelectionController = new GridSelectionControllerExt(this.sfGrid);
internal class GridSelectionControllerExt : GridSelectionController
public GridSelectionControllerExt(SfDataGrid datagrid) : base(datagrid)
protected override void ProcessPointerPressed(MouseButtonEventArgs args, RowColumnIndex rowColumnIndex)
args.Handled = true;
Hi, I've just give a try at your sample but is not that I want to do.
I'm understood that my problem is the SelectionMode="Multiple" of the DataGrid.
When I set Multiple instead "Row" in the SelectionMode the user can select multiple rows by hold down the left button and moving down or up the mouse.
I want to avoid it and give the multiple selection only by a click of the left button.
The click of the left button + the shift key is welcome but what I want to eliminate is the selection with the button hold while the mouse is moved down or up.
I've solved my trouble myself.
Many thanks for your sample that give me the right inspiration.
I've thinked to go browsing the object class sfgrid from inside Visual Studio and found the solution near the method you have overrided.
My solution that work perfectly for me is:
protected override void ProcessPointerMoved(System.Windows.Input.MouseEventArgs args, Syncfusion.UI.Xaml.ScrollAxis.RowColumnIndex rowColumnIndex)
args.Handled = true;
With this override in your example and with the "SelectionMode" set to Multiple like in my application under development now it work!