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

Limit row height

14 Answers 198 Views
GridView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 16 Dec 2010, 02:10 PM
Hello,
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

Sort by
0
Veselin Vasilev
Telerik team
answered on 16 Dec 2010, 03:07 PM
Hello David,

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
Browse the videos here>> to help you get started with RadControls for WPF
0
David
Top achievements
Rank 1
answered on 17 Dec 2010, 08:03 AM
I do have several lines in the text ("/r,/n") in the data so I'll need to use IValueConverter.
Could you please tell me how do I set the column's IValueConverter using code. For example newGrid.Columns["desc"].????

Thank you
0
Pavel Pavlov
Telerik team
answered on 17 Dec 2010, 08:25 AM
Hi David,

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
Browse the videos here>> to help you get started with RadControls for WPF
0
David
Top achievements
Rank 1
answered on 17 Dec 2010, 09:51 AM
That's what I origanally thought but when I try to use "RadGridView.Colums["xxxxx"].DataMemberBinding.Converter"  I get :
'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?)
using Telerik.Windows.Data;
using Telerik.Windows.Controls;

what am I missing?
I've got :
using Telerik.Windows.Data;
using Telerik.Windows.Controls;

using Telerik.Windows.Data;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;

Thank you for your time
using Telerik.Windows.Data;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;
using Telerik.Windows.Controls;
0
Accepted
Veselin Vasilev
Telerik team
answered on 17 Dec 2010, 12:32 PM
Hi David,

Please first cast the column to GridViewDataColumn:

((GridViewDataColumn)RadGridView.Columns["xxxxx"]).DataMemberBinding.Converter = ...


Best wishes,
Veselin Vasilev
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
David
Top achievements
Rank 1
answered on 17 Dec 2010, 01:01 PM
Worked
Thank you so much
0
Sam
Top achievements
Rank 1
answered on 20 Jun 2017, 05:50 PM
Is using a converter still the best way to do this? Seems like this should be a property you can set directly on the RadGridView.
0
Sam
Top achievements
Rank 1
answered on 20 Jun 2017, 05:51 PM
Is using a converter still the best way to do this? Seems like making it a property on the RadGridView would be a much easier solution for this common problem.
0
Dilyan Traykov
Telerik team
answered on 23 Jun 2017, 11:49 AM
Hello Sam,

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
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 you to write beautiful native mobile apps using a single shared C# codebase.
0
Sam
Top achievements
Rank 1
answered on 23 Jun 2017, 12:50 PM

Thanks for the feedback.

I also added a feature request.

https://feedback.telerik.com/Project/143/Feedback/List/Your%20Items

0
Richard
Top achievements
Rank 1
answered on 14 Aug 2017, 04:06 PM

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.

0
Dilyan Traykov
Telerik team
answered on 15 Aug 2017, 08:37 AM
Hello Richard,

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
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 you to write beautiful native mobile apps using a single shared C# codebase.
0
Miles
Top achievements
Rank 1
answered on 31 Jan 2019, 11:06 AM

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

0
Martin Ivanov
Telerik team
answered on 05 Feb 2019, 08:18 AM
Hello Miles,

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
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
David
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
David
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Sam
Top achievements
Rank 1
Dilyan Traykov
Telerik team
Richard
Top achievements
Rank 1
Miles
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or