Very slugish performance when using RowStyleSelector

1 posts, 0 answers
  1. Ivo
    Ivo avatar
    48 posts
    Member since:
    Jul 2011

    Posted 14 Dec 2016 Link to this post

    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);
        }
    }

     

Back to Top