This is a migrated thread and some comments may be shown as answers.

RadGridView Summary Row Alignment

1 Answer 470 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Gregory Gilmore
Top achievements
Rank 1
Gregory Gilmore asked on 06 May 2010, 08:16 PM
Hi,

I have a winforms radGridView with a group summary row that sums various fields.  From reading other posts I understand that to format the summary row I need to use the viewCellFormatting event.  My question it why does the text (numeric data) not get aligned to the middleRight by the following code?

 private void rgvFinancials_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
        {
            if (e.CellElement is Telerik.WinControls.UI.GridSummaryCellElement)
            {
                float f = 8.25f;
                                
                e.CellElement.Alignment = ContentAlignment.MiddleRight;
                e.CellElement.Font = new Font("Microsoft Sans Serif", f, FontStyle.Bold, GraphicsUnit.Point);
                e.CellElement.UpdateLayout();
            }
        }



The Font size and bold properties are being set correctly but the text alignment appears to be centered not to the right.





1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 10 May 2010, 04:14 PM
Hi Gregory Gilmore,

You should set the TextAlignment property in this case. You should not call the UpdateLayout method when handling CellFormatting event. It will have no effect. Also, the font is a system resource and CellFormatting fires many times. Creating every time a new font instance will slow down your application and will increase the memory consumption.

A bit off topic, please ask the person who has purchased our controls in your company to add you as a License Developer to the purchase. This will give you full access to the products your company has purchased, to our downloads section, and to our support ticketing system. Additionally, all your questions will be reviewed according to the license you have. More information on License Developers you can find here: www.telerik.com/account/faqs.aspx.

Greetings,
Jack
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Gregory Gilmore
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or