DataGrid: Setting default row height while allowing content fitting

1 Answer 17 Views
DataGrid
PalmSens
Top achievements
Rank 1
PalmSens asked on 29 Oct 2025, 02:13 PM

For the current project I need a datagrid with smaller rows, which fit precisely around the template. I can do this with the RowHeight property. However, I also have some cells with multiline text, where the rows need to be larger. I can do this by setting the RowHeight to NaN, but this also means the rowheight otherwise uses the default value of 48, while I need it to default to 20. Is there any good way to do this? I already tried setting TelerikGrid_RowHeight to 20 in the local resource dictionary (merged into the app resource dictionary), but this doesn't seem to fix it.

The template columns contain the following template: 

$$"""<DataTemplate xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextBlock  Text="{Binding [{{dataColumn}}]}"
            Margin="4,0"
            VerticalAlignment="Center"/>
</DataTemplate>"""
I'm using this template here because each row is an object[], so I can't provide property names and need to provide a binding instead.

1 Answer, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 03 Nov 2025, 03:08 PM

Hi,

Currently, there is no mechanism to get the desired effect. The RowHeight=NaN setting will ensure that rows with higher content are stretched, but the rows with smaller heights will still be measured with a default minimum size. At this moment, there is no proper approach that I can suggest for your scenario.

Regards,
Martin Ivanov
Progress Telerik

Your perspective matters! Join other professionals in the State of Designer-Developer Collaboration 2025: Workflows, Trends and AI survey to share how AI and new workflows are impacting collaboration, and be among the first to see the key findings.
Start the 2025 Survey
Tags
DataGrid
Asked by
PalmSens
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or