Posted 4 December 2019, 11:50 pm EST
Hello,
Which event fires when a c1list headercheckbox is ticked / unticked ?
Regards
Brian
Forums Home / ComponentOne / WinForms Edition
Posted by: softcomlimited on 4 December 2019, 11:50 pm EST
Posted 4 December 2019, 11:50 pm EST
Hello,
Which event fires when a c1list headercheckbox is ticked / unticked ?
Regards
Brian
Posted 4 December 2019, 11:51 pm EST
Also is there a way to programmatically tick or untick headercheckbox ?
Regards
Brian
Posted 5 December 2019, 5:23 am EST
Hello,
HeaderCheckBox is shown in the C1List when the following properties are set :
C1List1.SelectionMode = C1.Win.C1List.SelectionModeEnum.CheckBox;
C1List1.ShowHeaderCheckBox = true ;
1 : These checkboxes are used to handle the selection of rows in the C1List so there is no direct event to handle the tick/untick of those checkboxes but by the help of the selection event you can handle it.
Code snippet is given below :
private void C1List1_SelectionChanged(object sender, EventArgs e)
{
bool temp = true;
for (int i = 0; i < C1List1.VisibleRows; i++)
{
if (!C1List1.GetSelected(i))
{
temp = false;
break;
}
}
if (!temp)
{
Console.WriteLine("Not All Selected");
}
else
{
Console.WriteLine(" All Selected");
}
}
2: If you want to tick or untick that checkbox programmatically then you need to select/deselect all rows by code :
//Select All
for (int i = 0; i < C1List1.VisibleRows; i++)
{
C1List1.SetSelected(i, true);
}
//Deselect All
C1List1.ClearSelected();
If you need any other help, please let us know.
Regards,
Prabhat Sharma.
Posted 5 December 2019, 8:36 am EST
Mr Sharma,
I don’t see a SelectionChanged event but I do have SelectedValueChanged and SelChange events and neither of those fire when the headercheck is used.
I have version 4.0.20151.38
Thanks
Brian
Posted 6 December 2019, 3:18 am EST
Hello Brian,
You are correct that SelectionChanged event was not available in 2015V1 build as it was introduced in 2015V3 builds to handle the selection.
I kindly request you to upgrade the builds so that you can access the SelectionChanged event when HeaderCheckBox is clicked.
You can download the builds from the given link :
https://www.grapecity.com/download/product-componentone
Regards,
Prabhat Sharma.