Selection with VirtualGrid not working in "Multiple" selection mode

1 Answer 70 Views
VirtualGrid
Amon
Top achievements
Rank 1
Amon asked on 04 Oct 2024, 05:04 PM

I ran into this problem when experimenting with VirtualGrid, but trying to work with Multiple selection mode seems completely broken. I have even created a new project from scratch and only imported the following packages:

telerik.windows.controls.for.wpf.xaml (2024.3.924)
telerik.windows.controls.virtualgrid.for.wpf.xaml (2024.3.924)

My MainWindow.xaml looks like:

<Window x:Class="TestVirtGrid.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:local="clr-namespace:TestVirtGrid"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="50"/>
        </Grid.RowDefinitions>
        <telerik:RadVirtualGrid x:Name="VirtGrid" CanUserEdit="False" Grid.Row="0" SelectionMode="Multiple" SelectionUnit="Row" />
        <Button Grid.Row ="1" Content="amon"/>
    </Grid>
</Window>

The code-behind looks like:

using System.Collections.ObjectModel;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Telerik.Windows.Controls.VirtualGrid;

namespace TestVirtGrid
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            ObservableCollection<Test> list = [];
            for (int i = 0; i < 20; i++)
                list.Add(new Test() { a = i, b = i });
            VirtGrid.DataProvider = new DataProvider(list);
        }

    }
    public class Test
    {
        public int a { get; set; }
        public int b { get; set; }
    }
}

When running the application, I'm able to select rows, but deselecting is clearly not working as intended. When I try to deselect, it often just completely fails to do so. Sometimes (like, 1 in 5 tries?) it does end up deselecting the row.

If there's something I've done wrong here, please let me know, otherwise I'd like to get some confirmation that this module doesn't work.

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 09 Oct 2024, 10:04 AM

Hello Amon,

Thank you for the provided code.

I can confirm that this is a bug in the RadVirtualGrid selection logic. I have logged it in our feedback portal and updated your Telerik points. Currently, there is no convenient workaround that I can suggest, aside from handling the PreviewMouseLeftButtonDown event and handling the current cell and the selection using C# code, but I can't tell if this is going to work well with the other click-related actions of RadVirtualGrid.

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
VirtualGrid
Asked by
Amon
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or