Completed
Last Updated: 31 May 2016 05:56 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 05 May 2016 06:28
Category: GridView
Type: Bug Report
1
FIX. RadGridView - ConditionalFormattingObject is not applied to the first row in multiple selection with Shift
To reproduce: make sure only the first row is selected then Shift select row 3.
DataTable dt = new DataTable();

dt.Columns.Add("Value", typeof(int));
dt.Columns.Add("Date", typeof(DateTime));
dt.Columns.Add("Description", typeof(string));

for (int index = 0; index < 15; index++)
{
    dt.Rows.Add(new object[] { index % 5, DateTime.Now.AddSeconds(10), "Index = " + index });
}

radGridView1.DataSource = dt;
radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
radGridView1.MultiSelect = true;

foreach (GridViewColumn col in this.radGridView1.Columns)
{
    ConditionalFormattingObject obj = new ConditionalFormattingObject("Value",
        ConditionTypes.Equal,
        col.Index.ToString(),
        "",
        true);
    obj.RowBackColor = Color.SkyBlue;
    obj.RowForeColor = Color.Red;
    obj.TextAlignment = ContentAlignment.MiddleRight;
    obj.ApplyOnSelectedRows = false;
    this.radGridView1.Columns[0].ConditionalFormattingObjectList.Add(obj);
}

Workaround: use the CellFormatting event to apply the desired formatting by using the API for overriding theme settings: 

http://docs.telerik.com/devtools/winforms/gridview/cells/formatting-cells
http://docs.telerik.com/devtools/winforms/telerik-presentation-framework/override-theme-settings-at-run-time
0 comments