How to dynamically change font size of Grid

6 posts, 0 answers
  1. Peter Meinl
    Peter Meinl avatar
    35 posts
    Member since:
    Jan 2010

    Posted 05 Feb 2010 Link to this post

    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?
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 09 Feb 2010 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Peter Meinl
    Peter Meinl avatar
    35 posts
    Member since:
    Jan 2010

    Posted 09 Feb 2010 Link to this post

    And how do I change RowHight and ColumnWidth's proportionally?
  5. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 09 Feb 2010 Link to this post

    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.
  6. Peter Meinl
    Peter Meinl avatar
    35 posts
    Member since:
    Jan 2010

    Posted 09 Feb 2010 Link to this post

    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?

  7. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 09 Feb 2010 Link to this post

    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.
Back to Top
UI for WPF is Visual Studio 2017 Ready