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.

Underline does not work in WPF grid

Thread ID:

Created:

Updated:

Platform:

Replies:

97896 Jan 18,2011 12:10 PM Jan 26,2011 06:19 AM WPF 5
loading
Tags: GridControl
Ray Huger
Asked On January 18, 2011 12:10 PM

In my GridQueryCellInfoEventHandler

I have the following code:

e.Style.Font.FontWeight = _headerStyle.Font.FontWeight;
e.Style.Font.FontStyle = _headerStyle.Font.FontStyle;
e.Style.Font.TextDecorations = _headerStyle.Font.TextDecorations;

FontWeight works. FontStyle works. TextDecorations does not work.

I've tried hard coding to:

e.Style.Font.TextDecorations = TextDecorations.Underline;

Still does not work.

Am I doing something wrong?


Manikandan [Syncfusion]
Replied On January 21, 2011 02:41 AM

Hi Ray,

Thanks for using Syncfusion Products.

You can achieve your requirement by setting TextDecoration on loading the grid itself, instead of assigning it in QueryCellInfo. After applying the styles you have to call the InvalidateVisual to refresh the grid as follows,

Code snippet [C#]
Grid.Model.InvalidateVisual(true)

We have developed a sample based on your requirement, Please download the sample in the following location.

Sample : http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GridControls-1392950256.zip

Note : In the sample we have applied the TexDecoration in the Constructor itself.

Please let us know if have any queries.

Thanks,
Manikandan JR.





Ray Huger
Replied On January 21, 2011 02:13 PM

Thank you for your response.

However, I do not understand why TextDecoration is handled separately from other style properties like FontWeight and Foreground.

I have a huge table and the Syncfusion Grid has the very important virtualization capabilty I need to style only the cells that come into view. The whole point of UNDERLINING is to give EMPHASIS to the occasional cells within a large population that have unusual values. So I have to be able to apply underlining just-in-time and selectively.

Your example does not do that.


Kamalakannan A [Syncfusion]
Replied On January 24, 2011 03:27 AM

Hi Ray,

Thanks for your update.

The TextDecorations property is completely different from the FontWeight, FontStyle etc. The FontWeight, FontStyle properties are Enum property where the values can be assigned to the particular property directly. But the TextDecorations is a collection of IList where it acts as a complex property contains Location and Pen property in it. Hence an object should be created for this collection and only this can be added in the collection.

However you can use this property in the QueryCellInfo event as this QuerycellInfo event will draw the cells only which is visible inside the scroll viewer.

[Code Snippet] [C#]

grid.Model.QueryCellInfo += new Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventHandler(Model_QueryCellInfo);

void Model_QueryCellInfo(object sender, Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventArgs e)
{
grid.Model[e.Cell.RowIndex, e.Cell.ColumnIndex].CellValue = string.Format("{0},{1}", e.Cell.RowIndex, e.Cell.ColumnIndex);
grid.Model[e.Cell.RowIndex, e.Cell.ColumnIndex].Font.TextDecorations = new TextDecorationCollection();
grid.Model[e.Cell.RowIndex, e.Cell.ColumnIndex].Font.TextDecorations.Add(new TextDecoration { Location = TextDecorationLocation.Strikethrough, Pen = new Pen(Brushes.Red, 2) });

}


Please let us know if have any queries.

Thanks,
Kamal.



Ray Huger
Replied On January 24, 2011 09:46 AM

I upgraded to 8.4.0.10 and that enabled setting Underline in Model_QueryCellInfo.


Kamalakannan A [Syncfusion]
Replied On January 26, 2011 06:19 AM

Hi Ray,

Thanks for your update.

Please let us know if have any queries.

Regards,
Kamal.



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.

;