Declined
Last Updated: 15 Oct 2015 11:04 by ADMIN
ADMIN
Ralitsa
Created on: 06 Nov 2014 10:14
Category: GridView
Type: Bug Report
1
FIX. RadGridView - the font of conditionally formatted cell is not reset correctly, when using the RowFormatting event in an inherited grid.
To reproduce: 
1. Add GridView which inherits the RadGridView
2. Populate the grid with some data
3. Add conditional formatting and set RowBackColor and CellBackColor 
4. Subscribe to RowFormatting event and change the font of selected row: 
void radGridView2_RowFormatting(object sender, RowFormattingEventArgs e)
{
    if (e.RowElement.IsSelected)
    {
        e.RowElement.Font = new Font(this.Font.FontFamily, this.Font.Size + 2, FontStyle.Bold);
    }
    else
    {
        e.RowElement.ResetValue(LightVisualElement.FontProperty, ValueResetFlags.Local);
        //e.RowElement.Font = this.Font;
    }
}

5. Select row with conditional formatting. The font of selected row is bold which is correct. Select another row and you will see that the previous row is still bold.

Workaround: 
Subscribe to CellFormatting event instead RowFormatting
void radGridView2_CellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.Row.IsSelected)
    {
        e.CellElement.Font = new Font(this.Font.FontFamily, this.Font.Size + 2, FontStyle.Bold);
    }
    else
    {
        e.CellElement.ResetValue(LightVisualElement.FontProperty, ValueResetFlags.Local);
    }
}
1 comment
ADMIN
Ralitsa
Posted on: 15 Oct 2015 11:04
The observed behaviour is not an issue with RadGridView. When you inherit from a RadControl (or any RadControl descendant), the original control themes are not automatically inherited. This behavior can be overridden very easily by overriding the ThemeClassName property of the descendant of RadControl. More information can be found in our documentation: http://www.telerik.com/help/winforms/tpf-inherit-themes-from-radcontrols-derivatives.html