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

Cells with overridden GridViewCellStyle no longer show their horizontal gridlines

1 Answer 83 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 28 Oct 2016, 12:52 PM

I have an MVVM view where I am overriding a GridViewDataColumn.CellStylewith a DataTrigger style that changes the colour of the Background based on the cell value (0 is red, >0 is green). This works great, except any cells that have been coloured this way no longer show their horizontal gridlines. The gridlines are still visible on other cells in the same row, and all vertical gridlines are still visible, but no horizontal gridlines on the custom styled cells.

 

Any idea what would cause the horizontal gridlines not to display just because the Background colour is overridden??

 

See attached image for an example of the grid with this styling in place.

 

<telerik:GridViewDataColumn DataMemberBinding="{Binding PriceBreak}" Header="Price Break" ColumnGroupName="MainPrice" Width="85" DataFormatString="{}{0:G29}">
                                    <telerik:GridViewDataColumn.CellStyle>
                                        <Style TargetType="telerik:GridViewCell" BasedOn="{StaticResource GridViewCellStyle}">
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding PriceBreak, Converter={StaticResource DecimalGreaterThanZeroToBooleanConverter}}" Value="False">
                                                    <Setter Property="Background" Value="#FDEDED"/>
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding PriceBreak, Converter={StaticResource DecimalGreaterThanZeroToBooleanConverter}}" Value="True">
                                                    <Setter Property="Background" Value="#EDFDEE"/>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </telerik:GridViewDataColumn.CellStyle>
                                </telerik:GridViewDataColumn>

1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan Nenchev
Telerik team
answered on 01 Nov 2016, 12:33 PM
Hi Tim,

Thank you for the picture and the Style implementation provided. Based on the picture, it seems that you are using the VisualStudio2013 theme. The issue you have reported is already logged as a bug in our internal system. I have added your case and increased its priority. You can follow its progress on the following link from our Ideas & Feedback Portal - GridView: Setting Background property of the cell hides horizontal grid lines. The issue comes from the fact that by default the GridViewCell is with a transparent background.

Tim, as a workaround, you can set a bottom margin for the GridViewCell:

<DataTrigger Binding="{Binding SomeValue}" Value="0">
<Setter Property="Background" Value="#FDEDED"/>
<Setter Property="Margin" Value="0 0 0 1"/>
</DataTrigger>

Please note that the issue is not represented with all Themes. The themes that are affected are ExpressionDark, Windows8, Windows8Touch, Office2013, and Green.

I hope the workaround will help. If you have any further questions or concerns, do not hesitate to contact us.

Regards,
Stefan Nenchev
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
Tags
GridView
Asked by
Tim
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Share this question
or