In the table I read from there are fields with values that are a few lines of string. After I load the table to the GridView, the GridView expands the rows' height so it could present all the data. I wanted to know how can I limit the rows' height in a way I'll see only the first row and the GridView won't expand. I've tried setting the "RowHeight" property of my GridView but it didn't do anything.
Thank you
14 Answers, 1 is accepted
Does your data (the long text) contain new lines?
If not you can set the TextWrapping="NoWrap" and TextTrimming="WordEllipsis" properties of the column.
If your data contains new lines, you might use a converter (IValueConverter) and convert the new lines into spaces for example and apply the above approach.
Let us know.
All the best,
Veselin Vasilev
the Telerik team
Could you please tell me how do I set the column's IValueConverter using code. For example newGrid.Columns["desc"].????
Thank you
In code or in XAML , the converter should be set on the DataMemberBnding of the column, rather than the column itself. Something like :
RadGridView.Colums["xxxxx"].DataMemberBinding.Converter = .....
Regards,
Pavel Pavlov
the Telerik team
'Telerik.Windows.Controls.GridViewColumn' does not contain a definition for 'DataMemberBinding' and no extension method 'DataMemberBinding' accepting a first argument of type 'Telerik.Windows.Controls.GridViewColumn' could be found (are you missing a using directive or an assembly reference?)
what am I missing?
I've got :
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;
Thank you for your time
Please first cast the column to GridViewDataColumn:
((GridViewDataColumn)RadGridView.Columns["xxxxx"]).DataMemberBinding.Converter = ...
Best wishes,
Veselin Vasilev
the Telerik team
Thank you so much
An alternative approach to using the converter would be to set the following style as the column's CellStyle or use it as an implicit style.
<
Style
TargetType
=
"telerik:GridViewCell"
>
<
Style.Resources
>
<
Style
TargetType
=
"TextBlock"
>
<
Setter
Property
=
"MaxHeight"
Value
=
"{Binding RowHeight, RelativeSource={RelativeSource AncestorType=telerik:GridViewDataControl}}"
/>
</
Style
>
</
Style.Resources
>
</
Style
>
If you wish, you may open a new feature request in our feedback portal regarding the introduction of a new property to control this. If the demand for it is high we will consider implementing it in future releases.
Regards,
Dilyan Traykov
Progress Telerik
Thanks for the feedback.
I also added a feature request.
https://feedback.telerik.com/Project/143/Feedback/List/Your%20Items
I agree that this isn't great, and will add this to the previous poster's feature request.
I had an out-of-the-box DataGrid with a RowHeight, which did exactly what I needed: it set a default Row Height to show as much as I wanted to see, but I could still resize the row if I wanted to see more data. I switched over to the Telerik RadGridView which has the same property with apparently no effect whatsoever - it always shows me all of the data.
Indeed, this behavior would be more intuitive. We will take this feedback into account once we start working on the implementation.
Regards,
Dilyan Traykov
Progress Telerik
Hi,
I just wondered if you could tell me if any progress has been made on this?
I have exactly the same problem where rows are increasing in height if they have more content but I want to bind RowHeight to a slider value so that it always sets the RowHeight regardless of what data is loaded.
What causes us more problems is when we scroll right/left and the row changes it's height during the scroll.
Many thanks.
Miles Young
This isn't planned for the next release. What I can suggest you so to follow the corresponding feedback item in the portal. This way you will get notified as soon as its status changes.
Regards,
Martin Ivanov
Progress Telerik