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. Image for the cookie policy date
close icon

Hidden column indicator

Hi, When a column is resized to have a width of 0, I want the seperator in the column headings to appear thicker, to indicate that there are a hidden column. (Like in Excell) Two Questions: 1) Is there a simple property I can set to get this behaviour? 2) If not, I tried the following code relying on the QueryCellStyleInfo and all seems fine, but when I have nested tables in the grid, the QueryCellStyleInfo does not fire for all columns, what might cause this? Another problem is that this event does not fire for the nested tables. private void My_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell || e.TableCellIdentity.TableCellType == GridTableCellType.TopLeftHeaderCell ) { GridColumnDescriptor gcd = this.TableDescriptor.Columns[e.TableCellIdentity.ColIndex]; if (gcd != null && gcd.Width <= 0 ) { e.Style.Borders.Right = new GridBorder(GridBorderStyle.Solid, Color.Black, GridBorderWeight.Thick); } }

4 Replies

AD Administrator Syncfusion Team November 14, 2005 12:33 PM UTC

There is no property setting that would do this for you. QueryCellStyleInfo should be raised for all cells no matter whether they are in nested tables or not whenever the grid needs a style. In your code, you use this.TableDescriptor.Columns. This only has the columns in the parent table. Instead, try using e.TableCellIdentity.Table.TableDescriptor.Columns which should pick out the current (maybe nested)TableDescriptor.Columns.


AL Andreas Liebenberg November 16, 2005 05:25 AM UTC

Hi, This is my code to Debug, I do NOT see all my columns headers, somehow the second column never goes through this with type "ColumnHeaderCell", Seems like all the others do. This happens on the parent table if it has nested tables. It does however show up as type "RecordFieldCell" but then it must be drawing the values. I never see the "ERROR !!!" in the parent table. What can I look for? private void MyGrid_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { try { GridColumnDescriptor gcd = e.TableCellIdentity.Table.TableDescriptor.Columns[e.TableCellIdentity.ColIndex]; Trace.WriteLine(gcd.HeaderText + " " + e.TableCellIdentity.ColIndex.ToString() + " Type " + e.TableCellIdentity.TableCellType.ToString() + " Width " + gcd.Width.ToString()); } catch { Trace.WriteLine("ERROR !!!!!!!!!!!!!!!!!"); } }


AD Administrator Syncfusion Team November 16, 2005 09:34 AM UTC

You can use e.TableCellIdentity.TabelCellType to pick out the column header cells. Here is a sample. http://www.syncfusion.com/Support/user/uploads/GGC_Nested_943c78ec.zip


AD Administrator Syncfusion Team November 21, 2005 08:43 AM UTC

Thanks a lot, the code in the sample works like a charm.

Loader.
Live Chat Icon For mobile
Up arrow icon