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

Striking off fonts for a row

hi,

I am using Grid Grouping control bound to a custom entity collection. The entity has a bool property named cancelled, which if true, should result in entire row to be shown off with fonts striked off?
How do i format fonts to be shown as striked off for entire row?

4 Replies

SS Shyam Sundhar Syncfusion Team April 3, 2007 02:49 AM UTC

Hi Dinesh,

The QueryCellStyleInfo event handler can be used for this. The following is the code snippet.

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record)
{
Element el = e.TableCellIdentity.DisplayElement;
Record rec = el.ParentRecord;
bool chk = (bool)rec.GetValue("Cancel");
if(chk)
e.Style.Font.Strikeout = true;
}
}

Check the attached sample for more details.

sample:
Sample


The TableModel.RowStyles will not work for GridGroupingControl. To format things and apply style settings, QueryCellStyleInfo is the event to be handled.


Best Regards,
S.Shyam.





DU dinesh upreti April 5, 2007 04:54 PM UTC

hi,
thanks for the sample. But i have a slightly tricky problem. I tried to figure that out my self but couldn't.
The problem is that i am using nested tables. and the nested entity is having the bool property cancelled.
i want the parent record to be striked off if one of the child record has the cancelled propert set to true.

Thanks in advance

>Hi Dinesh,

The QueryCellStyleInfo event handler can be used for this. The following is the code snippet.

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record)
{
Element el = e.TableCellIdentity.DisplayElement;
Record rec = el.ParentRecord;
bool chk = (bool)rec.GetValue("Cancel");
if(chk)
e.Style.Font.Strikeout = true;
}
}

Check the attached sample for more details.

sample:
Sample


The TableModel.RowStyles will not work for GridGroupingControl. To format things and apply style settings, QueryCellStyleInfo is the event to be handled.


Best Regards,
S.Shyam.





RA Rajagopal Syncfusion Team April 11, 2007 07:57 PM UTC

Hi Dinesh,

In your QueryCellStyleInfo event handler, you need to loop through the records of the nestedtables in parentrecord and then set the style you wanted through e.Style. Below is the code snippet.

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell ||
e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
Element el = e.TableCellIdentity.DisplayElement;
Record rec = el.ParentRecord;
if (rec.HasNestedTables)
{
foreach (GridRecord gr in el.ParentRecord.NestedTables[0].ChildTable.Records)
{
bool chk = (bool)gr.GetValue("Cancel");
if (chk)
e.Style.Font.Strikeout = true;
}
}
}
}

Here is a sample link showing this http://websamples.syncfusion.com/samples/Grid.Windows/Forum_58965/main.htm

Regards,
Rajagopal


RA Rajagopal Syncfusion Team April 11, 2007 07:59 PM UTC

Hi Dinesh,

In your QueryCellStyleInfo event handler, you need to loop through the records of the nestedtables in parentrecord and then set the style you wanted through e.Style. Below is the code snippet.

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell ||
e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
Element el = e.TableCellIdentity.DisplayElement;
Record rec = el.ParentRecord;
if (rec.HasNestedTables)
{
foreach (GridRecord gr in el.ParentRecord.NestedTables[0].ChildTable.Records)
{
bool chk = (bool)gr.GetValue("Cancel");
if (chk)
e.Style.Font.Strikeout = true;
}
}
}
}

Here is a sample link showing this http://websamples.syncfusion.com/samples/Grid.Windows/Forum_58965/main.htm


Regards,
Rajagopal

Loader.
Live Chat Icon For mobile
Up arrow icon