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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Striking off fonts for a row

Thread ID:

Created:

Updated:

Platform:

Replies:

58965 Apr 2,2007 03:33 PM UTC Apr 11,2007 07:59 PM UTC WinForms 4
loading
Tags: GridControl
dinesh upreti
Asked On April 2, 2007 03:33 PM UTC

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?

Shyam Sundhar [Syncfusion]
Replied On 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.




dinesh upreti
Replied On 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.




Rajagopal [Syncfusion]
Replied On 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

Rajagopal [Syncfusion]
Replied On 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

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.

Warning Icon 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.Close Icon

;