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

Restyle/Recolor Border of (Focused) Cell

1 Answer 355 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Barry
Top achievements
Rank 1
Barry asked on 27 Nov 2017, 07:37 PM

In a RadGridView, I am trying to change the border around the cell which has focus. Currently it appears as a faint grayish color, my boss has asked that I make it a darker, thicker border. Not having any luck so far. Why won't the Style definition below work?

 

<telerik:RadGridView.Resources>

                <Style TargetType="telerik:GridViewCell">

                    <Style.Triggers>

                        <Trigger Property="IsCurrent" Value="True">

                            <Setter Property="BorderBrush" Value="#000000" />

                            <Setter Property="BorderThickness" Value="2" />

                        </Trigger>

                    </Style.Triggers>    

                </Style>

</telerik:RadGridView.Resources>

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 30 Nov 2017, 07:26 PM
Hi,

This approach does not work for several reasons - the border thickness is bound and converted based on setters from the RadGridView and the VerticalGridLinesWidth. Furthermore, the current state of the grid view cell is set via a multitrigger for IsCurrent = true and IsInEditMode = false (in the WPF-only themes - Green, Office2016/Touch, Material) and via a VisualState x:Name="Current" (in the rest of the themes), in which a visual element in the template of the cell is shown/hidden. So in order to modify the visual appearance of the GridViewCell in the IsCurrent state, you can extract the control template for the cell and edit the setters of the Background_Current Border in it. In my opinion, it is cleaner and easier to copy the style from the generated resource dictionaries in the Themes.Implicit folder from the installation to be sure that it is properly extracted, rather than relying on the VS designer as there are some issues with the process that we are aware of and had reported to Microsoft. The same approach could be used to modify other states of the GridViewCell, such as IsMouseOver, IsSelected, is in edit mode, ect.

I hope that you help you in implementing a custom look for the GridViewCell. If you have any other queries, please do not hesitate to contact us further.

Regards,
Martin
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
Barry
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or