RowHeight property bound to FontSize property

2 posts, 0 answers
  1. Kumar
    Kumar avatar
    17 posts
    Member since:
    May 2011

    Posted 06 Feb 2012 Link to this post

    Hello Telerik team,

    I am trying to bind my RowHeight property on the RadTreeListView to the FontSize. 

    The reason I am doing this is that the user can change the FontSize at the application level using a setting on the menu and setting the RowHeight=20 (lets say) works for small fonts, but as the user increases the FontSize, the RowHeight hard set to 20 does not work well anymore as the content overflows

    Any ideas on how to adjust the RowHeight property based on the FontSize property?

  2. Nick
    Nick avatar
    593 posts

    Posted 08 Feb 2012 Link to this post

    Hi Kumar,

    You can use the RowLoaded event to set a binding to the FontSizeProperty of the row that has been loaded.
    The RowHeightProperty is being changed automatically when the FontSizeProperty is being changed. However you can use the same approach to set binding to it too.

    private void GridView_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
                //e.Row.SetBinding(GridViewRow.HeightProperty, new Binding("RowHeight") { Mode = BindingMode.TwoWay });
                e.Row.SetBinding(GridViewRow.FontSizeProperty, new Binding("FontSize") { Mode = BindingMode.TwoWay });

    Hope this helps!   Kind regards,
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
Back to Top