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

Very slugish performance when using RowStyleSelector

0 Answers 25 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 14 Dec 2016, 04:26 PM

Hi,

I'm seeing very degraded performance when I'm suign RowStyleSelector.
Here is my code for the selector. It is very simple. Is there anything I can do?

 

public class TimeReportGridRowStyleSelector : StyleSelector
{
    public Style LockedForEditingStyle { get; set; }
    public Style AlternateRowStyle { get; set; }
 
    public override Style SelectStyle(object item, DependencyObject container)
    {
        var row = item as ITimeReportRowItemBase;
 
        if (row != null && row.Locked)
            return LockedForEditingStyle;
 
        var items = ((GridViewRow)container).GridViewDataControl.Items;
 
        if (items.IndexOf(item) % 2 == 1)
            return AlternateRowStyle;
 
        return base.SelectStyle(item, container);
    }
}

 

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Tim
Top achievements
Rank 1
Share this question
or