Frozen Columns Splitter does not stretch across the "Click here to add new item" row

1 Answer 35 Views
GridView
Sven
Top achievements
Rank 1
Sven asked on 14 Jan 2022, 12:36 PM

Hi,

I am currently working on a RadGridView component where I want the Frozen Columns Splitter to also cover the row for adding new rows to the grid, see picture:

I want the grid splitter to also cover the red part.

Could you advice me on how to accomplish that?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 19 Jan 2022, 10:11 AM

Hello Sven,

I have provided an answer to the opened ticket regarding this matter. However, for the fullness of the answer, I will share the solution here as well.

To achieve the result, the default control template of the GridViewNewRow element would need to be extracted. Then, find the VisualState with x:Name="ReadOnlyMode" and change the Visibility to Visible of the ObjectAnimationUsingKeyFrames object with Storyboard.TargetName="PART_DataCellsPresenter". Finally, create a new Style with TargetType="telerik:GridViewNewRow" and set its Template property to the extracted and modified control template.

The following code snippets show this logic's implementation:

<VisualState x:Name="ReadOnlyMode">
    <Storyboard>
        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_DataCellsPresenter" Storyboard.TargetProperty="Visibility">
            <DiscreteObjectKeyFrame KeyTime="0">
                <DiscreteObjectKeyFrame.Value>
					<!--Set Visibility to Visible-->
                    <Visibility>Collapsed</Visibility>
                </DiscreteObjectKeyFrame.Value>
            </DiscreteObjectKeyFrame>
        </ObjectAnimationUsingKeyFrames>
...
<Style TargetType="telerik:GridViewNewRow" BasedOn="{StaticResource GridViewNewRowStyle}">
    <Setter Property="Template" Value="{StaticResource MyModifiedTemplate}"/>
</Style>

Please note that the default control template of the used theme in your application, would need to be extracted, otherwise it may lead to unwanted results.

The produced result is as follows (with the Office_Black theme used):

With this approach, the borders of the columns would also be visible, as observed in the above image. Due to the nature of the wanted result, this was the only possible approach I could come up with. This is because, with the current implementation of the RadGridView control, the borders of the columns, as well as the FrozenColumnSplitter element are intended to be hidden under the Border element ("Click here to add new item" visual element).

I have attached a sample project, that has this approach implemented, so, could you give it a try?

Regards,
Stenly
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
GridView
Asked by
Sven
Top achievements
Rank 1
Answers by
Stenly
Telerik team
Share this question
or