We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Checkbox selection

Thread ID:

Created:

Updated:

Platform:

Replies:

146023 Jul 17,2019 10:16 AM UTC Nov 27,2019 05:30 AM UTC WPF 13
loading
Tags: SfDataGrid
Ondrej Svoboda
Asked On July 17, 2019 10:16 AM UTC

Hi,
I'm working with touch devices where multiselection in grid is needed. But I would need sort of combination of extended and multiple selection modes. My idea is inspired by windows explorer multiselection:

SfDataGrid with extended SelectionMode where in row header there is checkbox to select the row. By tapping on row headers user can de/select multiple rows (like in multiple selection mode), but when tapping on other cells only this row gets selected (like in extended selection mode). In grid header of row headers there can be another checkbox to de/select all rows.

Is something like that possible?
If not possible to use row headers, than normal column could be used, but row header would be perfect.

Thanks
Ondřej

Susmitha Sundar [Syncfusion]
Replied On July 18, 2019 05:00 PM UTC

Hi Ondrej, 
 
Thank you for using Syncfusion controls. 
 
Based on the provided information, your requirement of “RowHeader CheckBox selection of DataGrid” can be achieved using the RowSelectionController and SelectionChangedEvent of DataGrid. We have prepared sample based on your requirement, please find the sample by the following link. 
 
We hope this helps. Please let us know, if need any further assistance. 
 
Regards, 
Susmitha S 


Ondrej Svoboda
Replied On July 22, 2019 04:44 PM UTC

Hi Susmitha,
I'm not super happy that your solution requires IsChecked property in OrderInfo. But if there is no other way I can live with it. 
(I think having build in support for functionality like this would be useful for a lot of people targeting touch devices)

Still I have some problems with that. I changed SelectionMode to Extended (as described in my question):
  • select all using Ctrl+A is not working as expected - rows are selected but checkboxes are empty
  • I select all using header checkbox, then clicking some row to select only that one throws System.StackOverflowException
  • I click checkbox in the first row than checkbox in the second row expecting both rows getting selected but only second row stays selected.
Thanks for your help
Ondřej

Susmitha Sundar [Syncfusion]
Replied On July 24, 2019 06:22 PM UTC

Hi Ondrej, 

Thank you for your update. 

We have analyzed your reported query. Please find the response , 
Query 1: select all using Ctrl+A is not working as expected - rows are selected but checkboxes are empty 
We have added the ProcessKeyDown Method in SelectionController. Now it works fine as expected. 
C#: 
protected override void ProcessKeyDown(KeyEventArgs args) 
        { 
            if (Keyboard.IsKeyDown(Key.A) && SelectionHelper.CheckControlKeyPressed()) 
            { 
                this.DataGrid.SelectionController.ClearSelections(false); 
                this.DataGrid.SelectRows(1, this.DataGrid.GetLastDataRowIndex()); 
                var collectioncount = (DataGrid.DataContext as ViewModel).OrderInfoCollection.Count; 
                var selecteditemcount = DataGrid.SelectedItems.Count; 
                if (selecteditemcount == collectioncount) 
                    (this.DataGrid.DataContext as ViewModel).IsHeaderChecked = true; 
                else if (selecteditemcount == 0) 
                    (this.DataGrid.DataContext as ViewModel).IsHeaderChecked = false; 
                else 
                    (this.DataGrid.DataContext as ViewModel).IsHeaderChecked = null; 
 
                foreach (var collection in (DataGrid.DataContext as ViewModel).OrderInfoCollection) 
                { 
                    if (collection.IsChecked == false) 
                        collection.IsChecked = true; 
                } 
                return; 
            } 
            base.ProcessKeyDown(args);  // Base method calling  
        } 
        

Query 2: I select all using header checkbox, then clicking some row to select only that one throws System.StackOverflowException 
We have fixed this issue in sample level by adding the condition for Selection Mode

C#: 
private void AssociatedObject_SelectionChanged(object sender, GridSelectionChangedEventArgs e) 
        { 
            if (((e.OriginalSender as SfDataGrid).DataContext as ViewModel).IsHeaderChecked == true) 
            {           
 
                SfDataGrid dataGrid = e.OriginalSender as SfDataGrid; 
                if(dataGrid.SelectionMode==GridSelectionMode.Multiple) 
                { 
                    if (e.RemovedItems != null && e.RemovedItems.Count > 0) 
                    { 
                        var items = e.RemovedItems; 
                        var rowInfo = items[0] as GridRowInfo; 
                        var rowData = rowInfo.RowData as OrderInfo; 
                        rowData.IsChecked = true; 
                        dataGrid.SelectedIndex = dataGrid.ResolveToRecordIndex(rowInfo.RowIndex); 
                         
                    } 
                } 
                else if(dataGrid.SelectionMode==GridSelectionMode.Extended) 
                { 
                    if (e.AddedItems != null && e.AddedItems.Count > 0) 
                    { 
                        var items = e.AddedItems; 
                        var rowInfo = items[0] as GridRowInfo; 
                        var rowData = rowInfo.RowData as OrderInfo; 
                        rowData.IsChecked = true; 
                        dataGrid.SelectedIndex = dataGrid.ResolveToRecordIndex(rowInfo.RowIndex);                        
                    } 
                } 
                 
                 
            } 
        } 

Query 3: I click checkbox in the first row than checkbox in the second row expecting both rows getting selected but only second row stays selected 
 
This selection apply only for Multiple selection mode. If you want this, you need to change the selection mode from Extended to Multiple. 
 
Please refer the following link, 
 
Currently, we are analyzing the possibilities to consider this as feature request. We will update you complete details on July 26, 2019. 
 
Regards, 
Susmitha S 


Ondrej Svoboda
Replied On July 29, 2019 03:06 PM UTC

Hi,
How did you decided about implementing this as a new feature?
Thanks

Ondřej

Farjana Parveen Ayubb [Syncfusion]
Replied On July 30, 2019 07:43 AM UTC

Hi Ondrej, 
 
Thank you for your patience. 
 
We have considered to provide support for “Support for Binding the row selection status to a GridCheckBoxColumn or provide special checkbox column to associate the row selection” in WPF 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. 
 
You can also communicate with us regarding the open features any time using our Feature Report page.  
 
 
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, 
Farjana Parveen A 


Ondrej Svoboda
Replied On July 30, 2019 08:24 AM UTC

Thanks, can't wait to have this :-)

Farjana Parveen Ayubb [Syncfusion]
Replied On July 31, 2019 04:42 AM UTC

Hi Ondrej, 
 
Thank you for your update 
 
As we updated earlier we have considered your requirement. 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. 
 
You can also communicate with us regarding the open features any time using our Feature Report page.  
 
 
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, 
Farjana Parveen A 


Farjana Parveen Ayubb [Syncfusion]
Replied On September 25, 2019 11:09 AM UTC

Hi Ondrej,  
  
We are glad to announce that our Essential Studio 2019 Volume 3 Beta Release version 17.3.0.9 is rolled out with your requested feature “Support for Binding the row selection status to a GridCheckBoxColumn or provide special checkbox column to associate the row selection” and is available for download under the following link.  
  
 
Please find the code example and sample in the below location  
XAML 
<syncfusion:SfDataGrid    x:Name="dataGrid"                                                                                             AutoGenerateColumns="False"  
                       ItemsSource="{Binding Orders}"> 
      <syncfusion:SfDataGrid.Columns> 
            <syncfusion:GridCheckBoxSelectorColumn MappingName="SelectorColumn" /> 
      </syncfusion:SfDataGrid.Columns> 
</syncfusion:SfDataGrid> 
  
C# 
this.dataGrid.Columns.Add(new GridCheckBoxSelectorColumn()  
{  
       MappingName = "SelectorColumn" 
}); 
 
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.  
  
Regards,  
Farjana Parveen A  


Ondrej Svoboda
Replied On November 8, 2019 09:25 AM UTC

Hi,

this is exactly what I needed.

But there is one problem with that. Once row is selected I cannot deselect it by clicking on the checkbox in GridCheckBoxSelectorColumn. It seems like a bug. It's not working with extended selection mode, but with multiple selection mode it works fine.


Please check.


Shobika Palani [Syncfusion]
Replied On November 11, 2019 11:54 AM UTC

Hi Ondrej,   
  
We can reproduce the reported issue “SelectedRow does not deselected by clicking the checkbox in GridCheckBoxSelectorColumn with SelectionMode.Extended” and confirmed this as a bug from our end. Also, we have logged bug report for this issue and the fix for this issue will be included in our upcoming weekly NuGet on 19th November,2019.    
    
Also, we have created feedback link for the reported issue, and we request you to login to the below link to view further details.  
    
Note: The provided feedback link is private, and you need to login to view this feedback.    
   
We appreciate your patience until then.   
   
Regards,   
Shobika  


Ondrej Svoboda
Replied On November 19, 2019 12:58 PM UTC

Hi,
was the fix already released on nuget?

Thanks
Ondřej

Farjana Parveen Ayubb [Syncfusion]
Replied On November 20, 2019 11:45 AM UTC

Hi Ondrej, 
 
Sorry for the inconvenience caused.   
 
Due to complexity, we unable include this mentioned issue fix in our weekly NuGet release on November 19th, 2019 as planned. We are working on this with high priority and we need some more time to work on this. We will include this issue fix in our next weekly NuGet release which is schedule on 26th November 2019. 
 
We appreciate your patience until then. 
 
Regards, 
Farjana Parveen A 


Farjana Parveen Ayubb [Syncfusion]
Replied On November 27, 2019 05:30 AM UTC

Hi Ondrej, 
 
Sorry for the inconvenience.  
 
As we are working towards our 2019 Volume 4 release, we are unable to include the fix for this issue in our weekly NuGet released on 26th November, 2019. The fix will be included in our upcoming 2019 Volume 4 Beta release which is expected to be rolled out in the first week of December. We appreciate your patience until then.  
 
Regards, 
Farjana Parveen A 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon