Posted 5 July 2018, 9:28 pm EST
Hi,
I am able to observe the discrepancy in row background upon scrolling the grid. However, upon debugging the application, the cause of this behavior was when model with AccountBackGround other than Plum/LightPink/Orange was passed there was no specific Style returned which is why the grid was showing randomly any Style. Returning a default style for else part fixed the issue at my end.
public override Style SelectStyle(object item, DependencyObject container)
{
var model = item as DataItemComponent;
if (model != null)
{
if (model.AccountBackGround == "Plum")
{
return PlumCellTemplate;
}
else if (model.AccountBackGround == "LightPink")
{
return LightPinkCellTemplate;
}
else if (model.AccountBackGround == "Orange")
{
return OrangeCellTemplate;
}
[b]else
{
return NormalCellTemplate;
}[/b]
}
return null;
}
```[b]Xaml[/b]```
<[b]c:CheckResultStyleSelector.NormalCellTemplate>
<Style TargetType="c1:DataGridCellPresenter">
<Setter Property="Background" Value="{Binding C1DataGridExtension.RowBackground}" />
</Style>
</c:CheckResultStyleSelector.NormalCellTemplate>[/b]
```Please verify the fix using the attached modified sample application.
Regards,
Ruchir
[zip filename="SampleStyleSelector_modified.zip"]https://gccontent.blob.core.windows.net/forum-uploads/file-2e56c312-ed8e-43a2-b444-be0818e9f0a0.zip[/zip]