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?
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.
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;
}
}
}
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
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.
Ok thanks a lot. Considering there are keyboard shortcuts to do the same thing it probably does make sense to have an option for.