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

How to dynamically change font size of Grid

5 Answers 386 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Peter Meinl
Top achievements
Rank 1
Peter Meinl asked on 05 Feb 2010, 09:05 PM
I wont to let the user change the font sizes of a GridView using a Slider (like in Excel 2007) so he can see more data if he chooses a smaller font.
How cant I do this?

5 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 09 Feb 2010, 10:50 AM
Hi Peter Meinl,

Do this when your slider value changes:

this.grid.FontSize = 30; //I have hard-coded this but you will use the real value here.
this.grid.UpdateLayout();

This should do it.

Best wishes,
Ross
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Peter Meinl
Top achievements
Rank 1
answered on 09 Feb 2010, 11:31 AM
And how do I change RowHight and ColumnWidth's proportionally?
0
Rossen Hristov
Telerik team
answered on 09 Feb 2010, 12:10 PM
Hi Peter Meinl,

You can't do that at run-time. When you change the font and update layout cells are automatically adjusted.

Kind regards,
Ross
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Peter Meinl
Top achievements
Rank 1
answered on 09 Feb 2010, 01:11 PM
In my test the cell hight does ony adjust when the font size gets very big. It does not adjust when I select a smaller font size (see screenshot attached). There seems to be MinRowHight which I do not know how to change.

 

    Private Sub slidFontSize_ValueChanged(ByVal sender As ObjectByVal e As System.Windows.RoutedPropertyChangedEventArgs(Of Double)) Handles slidFontSize.ValueChanged  
        RadGridView1.FontSize = e.NewValue  
        RadGridView1.UpdateLayout()  
    End Sub 

How can I make the cell hight and width adjust too?

0
Rossen Hristov
Telerik team
answered on 09 Feb 2010, 01:34 PM
Hi Peter Meinl,

Can you send me your test project. I will try to think of something, but I am not sure that this will be possible.

Greetings,
Ross
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Tags
GridView
Asked by
Peter Meinl
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Peter Meinl
Top achievements
Rank 1
Share this question
or