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

How to set static row height

7 Answers 508 Views
GridView
This is a migrated thread and some comments may be shown as answers.
miro mrazik
Top achievements
Rank 1
miro mrazik asked on 21 Nov 2010, 12:12 PM
Greetings,

I put this RadGridView on my WPF form:

<telerikStyle:RadGridView x:Name="gvOutbox" IsReadOnly="True" CanUserReorderColumns="True" CanUserResizeColumns="True" CanUserSortColumns="True"                   
SelectionMode="Extended" telerikStyle:StyleManager.Theme="Office_Blue"/>

This C# code simply loads data from database using Linq to EF:

var db = new MyEntities();
  
var records = from d in db.Records
              select d;
  
gvOutbox.ItemsSource = records;

Everything's fine. Data is loaded into my grid, but one of my database field is of type TEXT and it holds multiline text. Now when I scroll horizontally through columns, GridView changes the height of the rows automatically when the multiline column is visible/invisible.
How can I turn this behavior off? I'd like to see just first line of the multiline text and elipses button in that column and of course I want to have static height of my rows.

Thank you

7 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 22 Nov 2010, 08:56 AM
Hello miro mrazik,

RadGridView has a property called RowHeight which will allow you to set a static height for all rows. Could you please try setting RowHeight to 25, for example.


Regards,
Milan
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Veselin Vasilev
Telerik team
answered on 22 Nov 2010, 09:24 AM
Hello miro mrazik,

Please find attached a sample project. It defines a CellTemplate and trims the long text.
In addition, you can benefit the ToolTipTemplate property to show the full text on mouse over.

Hope this helps.

Kind regards,
Veselin Vasilev
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
miro mrazik
Top achievements
Rank 1
answered on 22 Nov 2010, 09:26 AM
Hi,

I've already tried that property. Here is my xaml:

<Window x:Class="RadGridViewRowHeight.MainWindow"
        Title="MainWindow" Height="350" Width="525" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
    <Grid>
        <telerik:RadGridView  Name="radGridView1" RowHeight="25" AutoGenerateColumns="True"/>
    </Grid>
</Window>

Here is my C# code:
public partial class MainWindow : Window
 {
     class Customer
     {
         public int ID { get; set; }
         public string Name { get; set; }
         public string Address { get; set; }
     }
 
     public MainWindow()
     {
         InitializeComponent();
 
         var listOfCustomers = new List<Customer>();
         listOfCustomers.Add(new Customer { ID = 1, Name = "Miroslav Mrazik", Address = "Somewhere in Slovakia\nIn my hometown\nSlovakia" });
 
         radGridView1.ItemsSource = listOfCustomers;
     }
 }

The result is a single line with height greater than 25 and it shows whole address in Address field (all three lines). 
0
miro mrazik
Top achievements
Rank 1
answered on 22 Nov 2010, 09:55 AM
Thank you Veselin for an example. That's what I'm trying to reach but my problem is that I have too much fields in my database table, so I would like to be able to set the row height and trim the text field value in run-time with AutoGenerateColumns set to True. Is there any way how to do that or I have to simply turn autogenerating columns off and hardcode all of my columns?

 
0
Veselin Vasilev
Telerik team
answered on 25 Nov 2010, 12:35 PM
Hello miro mrazik,

Please find attached the modified project.

Hope it helps.

Sincerely yours,
Veselin Vasilev
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Sergey
Top achievements
Rank 1
answered on 13 Sep 2016, 06:00 AM
RowHeight Property dont work if ExpressionDark theme used
0
Dilyan Traykov
Telerik team
answered on 13 Sep 2016, 02:03 PM
Hello Sergey,

I'm attaching a sample project where the RowHeight property is respected in both parent and child RadGridView instances. Could you please have a look at it and let me know whether I've missed something of importance?

May I also kindly ask you to continue this discussion in the other forum thread you've responded to? Thank you in advance for your cooperation and understanding.

Regards,
Dilyan Traykov
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
miro mrazik
Top achievements
Rank 1
Answers by
Milan
Telerik team
Veselin Vasilev
Telerik team
miro mrazik
Top achievements
Rank 1
Sergey
Top achievements
Rank 1
Dilyan Traykov
Telerik team
Share this question
or