This is a migrated thread and some comments may be shown as answers.

SelectAll on virtualized row selects even tough IsEnabled is false

1 Answer 77 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 19 Jul 2017, 11:06 AM

Hallo,

I have the following situation:

- GridView with GridViewSelectColumn

- GridView ItemsSource bound with VirtualQueryableCollectionView

- GridViewRow is not always selectable (via IsEnabled), depending on the bound object
                        <Style TargetType="telerik:GridViewRow" BasedOn="{StaticResource GridViewRowStyle}">
                            <Setter Property="IsEnabled" Value="{Binding IsSelectable, Mode=OneWay}" />
                        </Style>

 

SelectAll is working properly, but only for the visual items.

Good: When triggering SelectAll, the visible GridViewRows which have IsEnabled = false, are not selected.

Bad: When triggering SelectAll, the not yet visualized GridViewRows will be selected once I scroll down in the list, thus ignoring the IsEnabled property on the gridviewrow.

 

Is there a way to fix this or am I missing something?

Thanks for your response!

Best regards,

Ben

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 24 Jul 2017, 10:37 AM
Hello,

RadGridView's selection is item-based and SelectAll would mark all of the items as selected. However, VirtualQueriableCollectionView relies on lazy-loading of its items, so invoking SelectAll on RadGridView will select only the visible (loaded) items. When some new items are loaded by VQCV after scrolling out of the initial viewport, RadGridView does not have notion whether they have to be selected or not.
A possible customization that will enabled this behavior is to select the new items when they are loaded:
void VQCVItemsLoaded(object sender, VirtualQueryableCollectionViewItemsLoadedEventArgs e)
        {
            if (. . .)
            {
                clubsGrid.Select(e.Items);
            }
        }
However, they will stay referenced by RadGridView's selection logic, so they will not be released by VQCV after scrolling them out of the viewport. In accordance to the item count of the data source, it may be reasonable to unselect them when they are unloaded.

Regards,
Ivan Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Ben
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or