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

Child Group Headings

Two questions: 1) Is it possible to show/hide the display of column headings for a *particular* child grouping? I''ve got a grouping that is 3 levels deep. I want to display headings on the first child group, but not below that level. 2) Is it possible to customize the text that appears in column headings in child groups? It seems like the text is taken from the data source column name and that there is no way to override this. I''ve tried handling drawing events for the cell - but changing the display text has no effect. I''ve also tried handling the QueryCellText and QueryValue events, but the QueryCellText only fires for "IndentCells" (!!!???) and the QueryValue event seems to NEVER fire. (Essential Tools is a nice product - but documentation that comes with help and the examples is woefully inadequate, in my opinion.) - da

2 Replies

DA David Arndt March 16, 2005 05:00 PM UTC

Answered my own question: You can cancel the drawing event and handle the drawing yourself from with the cell, as shown below. In my opinion, this event would be more meaningful if it were fired *before* the drawing takes place so you can simply change the display text and let the control do the actual drawing. if ( e.Inner.Style.CellType == "ColumnHeaderCell" ) { System.Diagnostics.Trace.WriteLine( string.Format("{0}:{1},''{2}''", e.Inner.Style.CellType, e.Inner.Style.CellValue, e.Inner.DisplayText ) ); Brush aBrush = new SolidBrush( Color.Black ); e.Inner.Graphics.DrawString( e.Inner.DisplayText + "!", this.Font, aBrush, e.Inner.TextRectangle ); e.Inner.Cancel = true; aBrush.Dispose(); } >Two questions: > >1) Is it possible to show/hide the display of column headings for a *particular* child grouping? I''ve got a grouping that is 3 levels deep. I want to display headings on the first child group, but not below that level. > >2) Is it possible to customize the text that appears in column headings in child groups? It seems like the text is taken from the data source column name and that there is no way to override this. I''ve tried handling drawing events for the cell - but changing the display text has no effect. I''ve also tried handling the QueryCellText and QueryValue events, but the QueryCellText only fires for "IndentCells" (!!!???) and the QueryValue event seems to NEVER fire. > >(Essential Tools is a nice product - but documentation that comes with help and the examples is woefully inadequate, in my opinion.) > >- da


AD Administrator Syncfusion Team March 17, 2005 12:31 AM UTC

Dave, 1) Each GridColumnDescriptor has a GridColumnDescriptor.GroupByOptions property where you can define group options for a certain group level. The GridColumnDescriptor.GroupByOptions will have precedence over TableDescriptor.ChildGroupOptions for the grouping level that is matching the GridColumnDescriptor.MappingName of the column (e.g. you have “Country” column and you then later group by the “Country” field). 2) You can handle the QueryCellStyleInfo event to replace the text before it is drawn – see the CustomSectionInGroup example for handling QueryCellStyleInfo. Stefan >Answered my own question: You can cancel the drawing event and handle the drawing yourself from with the cell, as shown below. In my opinion, this event would be more meaningful if it were fired *before* the drawing takes place so you can simply change the display text and let the control do the actual drawing. > > > if ( e.Inner.Style.CellType == "ColumnHeaderCell" ) > { > System.Diagnostics.Trace.WriteLine( string.Format("{0}:{1},''{2}''", e.Inner.Style.CellType, e.Inner.Style.CellValue, e.Inner.DisplayText ) ); > > Brush aBrush = new SolidBrush( Color.Black ); > e.Inner.Graphics.DrawString( e.Inner.DisplayText + "!", this.Font, aBrush, e.Inner.TextRectangle ); > e.Inner.Cancel = true; > > aBrush.Dispose(); > } > >>Two questions: >> >>1) Is it possible to show/hide the display of column headings for a *particular* child grouping? I''ve got a grouping that is 3 levels deep. I want to display headings on the first child group, but not below that level. >> >>2) Is it possible to customize the text that appears in column headings in child groups? It seems like the text is taken from the data source column name and that there is no way to override this. I''ve tried handling drawing events for the cell - but changing the display text has no effect. I''ve also tried handling the QueryCellText and QueryValue events, but the QueryCellText only fires for "IndentCells" (!!!???) and the QueryValue event seems to NEVER fire. >> >>(Essential Tools is a nice product - but documentation that comes with help and the examples is woefully inadequate, in my opinion.) >> >>- da

Loader.
Up arrow icon