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

RowHeight property bound to FontSize property

1 Answer 19 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Kumar
Top achievements
Rank 1
Kumar asked on 06 Feb 2012, 04:36 PM
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?

Thanks,
Kumar

1 Answer, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 08 Feb 2012, 01:55 PM
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,
Nik
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
TreeListView
Asked by
Kumar
Top achievements
Rank 1
Answers by
Nick
Telerik team
Share this question
or