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.

Striking off fonts for a row

Thread ID:

Created:

Updated:

Platform:

Replies:

58965 Apr 2,2007 11:33 AM Apr 11,2007 03:59 PM Windows Forms 4
loading
Tags: GridControl
dinesh upreti
Asked On April 2, 2007 11:33 AM

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 2, 2007 10:49 PM

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 12:54 PM

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 03:57 PM

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 03:59 PM

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.

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.

;