Once the grid is populated, the items that are visible seem to be fine. When we scroll right, as columns enter visible view, they don't always get the style applied. And, if I scroll back left and then back to the right again, the columns that do or do not get the style applied properly changes, so some that weren't styled now are and vice versa.
I can keep scrolling left and right and see different results each time, this is without reloading any data.
It seems to be worse if I have the deferred scrolling turned on and/or column virtualization turned on, but I still get the behavior with both turned off. I have not tried with row virtualization turned off as the grid won't work with our dataset if we do.
Our data is about 7k rows of about 70 columns wide. We saw this behavior a bit pre Q1 2011, but not nearly as bad, it is every single time now.
Any ideas?
13 Answers, 1 is accepted
Can you post your StyleSelector implementation?
Regards,Vlad
the Telerik team
Sure:
public class CRSCellStyleSelector : StyleSelector
{
public override Style SelectStyle(object item, DependencyObject container)
{
Style style = new Style(typeof(GridViewCell));
Setter visibilitySetter = new Setter(GridViewCell.VisibilityProperty, Visibility.Collapsed);
Setter readOnlySetter = new Setter(ReadOnlyCell.IsReadOnlyProperty, true);
CostReportingSystemComposite model = item as CostReportingSystemComposite;
var cell = container as GridViewCell;
if (model.IsVendorRow)
{
switch (cell.DataColumn.UniqueName)
{
case "CostData.ContractType":
style.Setters.Add(readOnlySetter);
style.Setters.Add(visibilitySetter);
break;
case "CostData.FinalMod":
style.Setters.Add(visibilitySetter);
break;
case "DistributionData.OriginalBudgetQuantity":
style.Setters.Add(visibilitySetter);
break;
}
return style;
}
return style;
}
}
public class QSRowStyleSelector : StyleSelector
{
public override Style SelectStyle(object item, DependencyObject container)
{
QuantitySystemCompositeDecorator model = item as QuantitySystemCompositeDecorator;
if (model.Quantity.IsFloodQuantityCostCode && !model.IsDisplayRowForFloodQuantity)
{
Style style = new Style(typeof(GridViewRow));
style.Setters.Add(new Setter(GridViewRow.VisibilityProperty, Visibility.Collapsed));
return style;
}
return base.SelectStyle(item, container);
}
}
When the page renders, the 'collapsed' rows are rendered as white space, if I scroll off the screen and back, they are rendered as normal rows, even though they should be hidden.
Thanks,
Bob
This is normal behavior, because you are trying to play with the GridViewRow's Visibility property. This results into blank spaces and other visual issues, because you are directly messing with the visual tree. I strongly recommend you to use the filtering approach in order to display only these items that satisfy your condition.
Vanya Pavlova
the Telerik team
Unfortunantly the second example was just an easier way to replicate the problem, and filtering doesn't address the first example.
Also, I just redid everything mimicking your ConditionalStyleSelector example and saw the same behavior.
Thanks,
Bob
I wanted to check in and see if this is still considered an open 'ticket' or are we assuming working as intended? Would it be preferable for us to call in? Is there anything else I can provide to help?
Thanks.
Messing with rows visibility will lead to unpredictable result since the grid virtualization is using this.
Regards,Vlad
the Telerik team
Thanks.
I've attached an example project demonstrating scenario similar to yours with with our Q1 2011 binaries. Everything is working as excepted.
Let us know if we've missed something.
Vlad
the Telerik team
Columns in the grid that are hidden through databinding are not collapsing, where they were before. Now I get a big gap of whitespace where the column was.
Before this update, this collapsed the column, is this by design or a bug?
This issue was fixed shortly our official release. You can get our latest build or wait for the official service pack - this week.
Greetings,Vlad
the Telerik team