left click mouse selection

How can I get left-click mouse selection to work  like it does in SfDataGrid? In SfTreeGrid I can shift-click to select multiple rows but I can't just hold left-click and move the mouse to select multiple.

I'm using Extended selection mode and obviously AllowSelectionOnPointerPressed is set to True. Is there another setting I'm missing or a way I could implement that easily?


5 Replies 1 reply marked as answer

DM Dhanasekar Mohanraj Syncfusion Team July 7, 2022 02:16 PM UTC

Hi John,

Currently, we are checking the feasibilities to achieve your requirement. We will check and update you further details on July 12, 2022.

We appreciate your patience until then.

Regards,
Dhanasekar M.



JO John July 9, 2022 10:06 PM UTC

I'm still curious what a good answer is to this but I've come with this solution. It seems to work so far.


    private void TreeGrid_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
    {
      // check for my data model
      if (e.OriginalSource is FrameworkElement elem && elem.DataContext is PlayerSubStats stats)
      {
        // Left click happened, current item is selected, now listen for mouse movement and release of left button
        treeGrid.PreviewMouseLeftButtonUp += TreeGrid_PreviewMouseLeftButtonUp;
        treeGrid.MouseMove += TreeGrid_MouseMove;
      }
    }

    private void TreeGrid_PreviewMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
    {
      // remove listeners if left button released
      treeGrid.PreviewMouseLeftButtonUp -= TreeGrid_PreviewMouseLeftButtonUp;
      treeGrid.MouseMove -= treeGrid_MouseMove;
    }

    private void TreeGrid_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
    {
      // check for my data model
      if (e.OriginalSource is FrameworkElement elem && elem.DataContext is PlayerSubStats stats)
      {
        if (treeGrid.CurrentItem != stats)
        {
          if (!treeGrid.SelectedItems.Contains(stats))
          {
            treeGrid.SelectedItems.Add(stats);
          }
          else
          {
            treeGrid.SelectedItems.Remove(treeGrid.CurrentItem);
            treeGrid.SelectedItems.Remove(stats);
          }

          treeGrid.CurrentItem = stats;
        }
      }
    }


AR Arulpriya Ramalingam Syncfusion Team July 11, 2022 03:19 PM UTC

Hi John,


As we promised earlier, we will check and update you on further details on 12th July 2022. In the meantime, we suggest you use a workaround in your previous update.


Regards,

Arulpriya Ramalingam



DM Dhanasekar Mohanraj Syncfusion Team July 12, 2022 02:11 PM UTC

Hi John,


We have analyzed and considered your requirement of “Provide a drag selection support for SfTreeGrid” and logged feature request for the same. We will implement this feature in any of our upcoming release.


At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We will let you know when this feature is implemented. We appreciate your patience until then.


Thank you for requesting this feature and helping us define it. We are always trying to make our products better and feature requests like yours are a key part of our product growth efforts.


Feedback link: https://www.syncfusion.com/feedback/36251/provide-a-drag-selection-support-for-sftreegrid


If you have any more specification/suggestions to the feature request, you can add it as a comment in the portal and cast your vote to make it count.

Regards,

Dhanasekar M.


Marked as answer

JO John July 12, 2022 06:22 PM UTC

Ok thanks a lot. Considering there are keyboard shortcuts to do the same thing it probably does make sense to have an option for.


Loader.
Up arrow icon