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.
Unfortunately, activation email could not send to your email. Please try again.

Checkbox appearance in GridControl

Thread ID:

Created:

Updated:

Platform:

Replies:

130287 May 4,2017 06:00 AM May 8,2017 01:32 AM Windows Forms 5
loading
Tags: GridControl
Boris Mouzo Izquierdo
Asked On May 4, 2017 06:00 AM

Hi,

On a Desktop application (NET 3.5) we have a GridControl and on certain cells we are showing a Checkbox. We've seen on some samples that the indeterminate/tristate state is shown as box with a filled square in it, but we haven't been able to set this appearance.

"Interactive Cell" sample in Grid Control:


The appearance we get is always this one:


How can we customize or set the tristate appearance to the one of the sample?

Kind regards... Boris

Mohanraj Gunasekaran [Syncfusion]
Replied On May 4, 2017 10:27 AM

Hi Boris, 
 
Thanks for using Syncfusion products. 
 
 
Query 
Solution 
We've seen on some samples that the indeterminate/tristate state is shown as box with a filled square in it, but we haven't been able to set this appearance. 
Solution1 
In order to use tristate appearance for CheckBox, you can use the TriState property in QueryCellInfo event. Please refer to the below code example and the attached sample, 
 
Code example 
this.gridControl1.QueryCellInfo += gridControl1_QueryCellInfo; 
 
void gridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) 
{ 
    if (e.Style.CellIdentity.ColIndex == 5 && e.Style.CellIdentity.RowIndex > 0) 
    { 
        e.Style.CellType = GridCellTypeName.CheckBox; 
        e.Style.TriState = true; 
        //Used to set the checked, unchecked and intermediate value for checkbox value 
        e.Style.CheckBoxOptions = new GridCheckBoxCellInfo("1", "0", "", true); 
    } 
} 
 
 
Solution2 
Also, you can achieve your scenario by using the below code example, 
 
Code example 
this.gridControl1[2, 5].CellType = GridCellTypeName.CheckBox; 
this.gridControl1[2, 5].TriState = true; 
this.gridControl1[2, 5]. CheckBoxOptions = new GridCheckBoxCellInfo("1", "0", "", true); 
 
 
 
 
Sample link: GridControl 
 
Screenshot 
 
 
 
Please refer the below UG and KB link to use the CheckBoxOptions property, 
 
 
Regards, 
Mohanraj G 


Boris Mouzo Izquierdo
Replied On May 4, 2017 10:37 AM

Hi,

To set or use the tristate is not the issue as we've already implemented it and it works fine. The question is, how can we show the indeterminate state as a filled out square in the chekbox instead of a grayed out check. Right now we have three states:
  • Checked: Shows a Check in the box
  • Unchecked: Shows an empty box
  • Indeterminate: Shows a Check in a grayed out box, looks like as if the CheckBox control were disabled but isn't so.

What we'd like to know is what needs to be set or configured to show the square in the box instead like in the image you posted.

Kind regards... Boris


Mohanraj Gunasekaran [Syncfusion]
Replied On May 5, 2017 02:19 AM

Hi Boris, 

Sorry for the inconvenience caused. 

In order to show the square box for intermediate state in the CheckBox, enable the ThemesEnabled property for GridControl. Please refer to the below code example and the sample, 
 
Code example 
this.gridControl1.ThemesEnabled = true; 
 
Sample link: GridControl 
 
Regards, 
Mohanraj G  


Boris Mouzo Izquierdo
Replied On May 5, 2017 03:39 AM

Hi,

I thought I had tried that one, too, but now it works. Or maybe I discarded it because by setting that control property to True I was loosing the visual style I had defined for the headers. To avoid this, the following line needs to be added if you want to keep a custom visual style:

            Me.grdControl.BaseStylesMap.Item("Column Header").StyleInfo.Themed = False

Kind regards... Boris

Mohanraj Gunasekaran [Syncfusion]
Replied On May 8, 2017 01:32 AM

Hi Boris, 

Thanks for your update. 

You were right. If you would not like to change the header appearance when enable themes for grid, you can use Themed property to disable the themes settings. Please refer the below code example, 

Code example 
To avoid themes settings for Headers (RowHeader and ColumnHeader) 
Me.gridControl1.BaseStylesMap.Header.StyleInfo.Themed = False; 
                      (or) 
Me.gridControl1.BaseStylesMap.Item("Header").StyleInfo.Themed = False; 
 

To avoid the Themes settings for RowHeader 
Me.gridControl1.BaseStylesMap.RowHeader.StyleInfo.Themed = False; 
                      (or) 
Me.gridControl1.BaseStylesMap.Item("Row Header").StyleInfo.Themed = False; 
 

To avoid the Themes settings for ColumnHeader 
Me.gridControl1.BaseStylesMap.ColumnHeader.StyleInfo.Themed = False; 
                      (or) 
Me.gridControl1.BaseStylesMap.Item("Column Header").StyleInfo.Themed = False; 
 


Anyway, we are glad to know that your reported problem has resolved. Please let us know, if you have any further assistance.  

Regards, 
Mohanraj G 


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.

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.

;