Cells with overridden GridViewCellStyle no longer show their horizontal gridlines

2 posts, 1 answers
  1. Tim
    Tim avatar
    11 posts
    Member since:
    May 2013

    Posted 28 Oct 2016 Link to this post

    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}">
                                            <Style TargetType="telerik:GridViewCell" BasedOn="{StaticResource GridViewCellStyle}">
                                                    <DataTrigger Binding="{Binding PriceBreak, Converter={StaticResource DecimalGreaterThanZeroToBooleanConverter}}" Value="False">
                                                        <Setter Property="Background" Value="#FDEDED"/>
                                                    <DataTrigger Binding="{Binding PriceBreak, Converter={StaticResource DecimalGreaterThanZeroToBooleanConverter}}" Value="True">
                                                        <Setter Property="Background" Value="#EDFDEE"/>
  2. Answer
    Stefan Nenchev
    Stefan Nenchev avatar
    665 posts

    Posted 01 Nov 2016 Link to this post

    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"/>

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

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

    Stefan Nenchev
    Telerik by Progress
    Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
Back to Top