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

GridViewCell left border missing

6 Answers 566 Views
GridView
This is a migrated thread and some comments may be shown as answers.
DKO
Top achievements
Rank 1
DKO asked on 17 May 2018, 09:23 AM

A couple of years ago I've created a custom GridViewCell Template that allowed me to set a custom border inside a cell.
All I had to do was change the BorderBrush and BorderThickness properties of the GridViewCell's style.

But since I've updated to a newer version of the control, this has stopped working. Now the left border is missing.
In the past I've had trouble with the bottom border but setting bottom margin to 1 solved that.
However changing the left margin doesn't fix the visibility of the left border.

This is the original custom GridViewCemm Template:

<Style TargetType="telerik:GridViewCell" x:Key="DefaultCellStyle">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="telerik:GridViewCell">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"  Background="{TemplateBinding Background}">
                            <ContentPresenter  Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ToolTip="{TemplateBinding ToolTip}" VerticalAlignment="Center" Margin="3,0"/>
                    </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="telerik:StyleManager.Theme" Value="Windows8" />
    <Setter Property="Margin" Value="0,0,0,1" />
</Style>

 

An example of how I used this:

<telerik:GridViewDataColumn  Header="Example" DataMemberBinding="{Binding MyBinding}" Width="100">
    <telerik:GridViewDataColumn.CellStyle>
        <Style TargetType="telerik:GridViewCell" BasedOn="{StaticResource DefaultCellStyle}">
            <Setter Property="BorderBrush" Value="Blue"/>
            <Setter Property="BorderThickness" Value="2"/>
        </Style>
    </telerik:GridViewDataColumn.CellStyle>
</telerik:GridViewDataColumn>

 

My previous version of the the control was: 2016.3.1024.45 Here the cell had a perfect border of thickness 2 all-round.
Current version: 2018.1.220.45 Here the left border is missing, the other borders are working fine.

I've tried several things but simply can't get it to work any more.

6 Answers, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 21 May 2018, 03:19 PM
Hello,

Thank you for all provided details. Indeed the behavior of our GridView has changed when using such custom style. I will need some more time to find the reason behind it, so please expect my follow-up in the same thread. Meanwhile I would suggest as a workaround changing the DefaultCellStyle as follows:

<Style TargetType="telerik:GridViewCell" x:Key="DefaultCellStyle">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="telerik:GridViewCell">
                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="2"  Background="{TemplateBinding Background}">
                    <ContentPresenter  Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ToolTip="{TemplateBinding ToolTip}" VerticalAlignment="Center" Margin="3,0"/>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="Margin" Value="0,0,0,1" />
</Style>

Please let me know if it is applicable for your project.

Regards,
Sia
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
DKO
Top achievements
Rank 1
answered on 24 May 2018, 06:59 AM

Defining the thickness like that shows a correct border all round but this unfortunately isn't good enough.

I'm looking forward to your follow-up.

0
DKO
Top achievements
Rank 1
answered on 25 May 2018, 12:52 PM

After doing some more testing I've discovered the following:

EnableColumnVirtualization = "False"

This will make the original code work again, and the left border becomes visible.
I'm not sure this is a solution though, because I'm worried about a possible performance loss as described in the following article.

This might help you with finding the source of the actual problem.

Please respond to this topic if you've found anything, or if this setting is the actual solution that I should use.
I've used this template all over my project and wish to know with certainty that this is an actual answer to my problem.
Because it would take a while to add this change to every GridView and would hate to find out this this setting causes a huge performance drop afterwards...

0
Sia
Telerik team
answered on 29 May 2018, 05:42 AM
Hello,

I could not think of another workaround of the reported issue. It was introduced with our new functionality related to frozen columns to the right. That is why we increased its priority and it will be fixed with the upcoming LIB, next Monday (on 04.06.2018). You can find your telerik points updated.

Could you please let me know why the suggested workaround does not fit your requirements as I would not recommend setting the EnableColumnVirtualization to False?

Regards,
Sia
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
DKO
Top achievements
Rank 1
answered on 29 May 2018, 08:47 AM

[quote]Sia said:
Could you please let me know why the suggested workaround does not fit your requirements as I would not recommend setting the EnableColumnVirtualization to False?

[/quote]

Because I don't want all the borders to have a fixed thickness of "2". I used this template multiple times in my project and it was specifically used to have the thickness customizable.
For example, some times I wanted a thickness of "2 1 2 1", and with your suggested workaround this isn't possible.
Or I would have to create a different template for every situation.

I knew that setting the EnableColumnVirtualization to False wasn't a solution but I was testing some stuff and noticed that this fixed the border issue, so I decided to share this with you to maybe help you discover the source of the problem.

I'm glad to hear that this will be fixed and I'm looking forward to the patch. Thank you.

0
Sia
Telerik team
answered on 30 May 2018, 08:54 AM
Hello,

Thank you for your explanation. Please track the following public item to see when the item is resolved. It is already forwarded to our developers and it is in development.

Regards,
Sia
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
DKO
Top achievements
Rank 1
Answers by
Sia
Telerik team
DKO
Top achievements
Rank 1
Share this question
or