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

UpdateLayout when a value (fontsize) changes

3 Answers 103 Views
TileView
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 04 May 2012, 03:44 AM
Hi,

I'm using a RadTileView and it contains some Textblocks. I have a Combobox above the RadTileView that contains int values for font sizes so that when a combobox selection is made the font size of the Textblocks are updated. When I adjust the window size of the RadTileView (with the mouse) it'll update the views so the new font size fits right. I'd like to update the views whenever the combobox is refreshed so I don't have to resize the window manually to achieve this. Preferably in xaml as the RadTileView is within a DataTemplate and difficult to get to.

If it's any help, the binding the Textblocks use is {Binding Source={StaticResource TVFieldSetsVM}, Path=CommonFontSize}.

Thanks

3 Answers, 1 is accepted

Sort by
0
Zarko
Telerik team
answered on 04 May 2012, 03:18 PM
Hi Peter,
Could you please send us some code snippets or a project because I wasn't able to reproduce the problem? I've attached the sample project that I used for testing so you could examine it and see it helps you.
We're looking forward to hearing from you.

Regards,
Zarko
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Peter
Top achievements
Rank 1
answered on 07 May 2012, 02:50 AM
Hi Zarko,

Thanks for the sample project. In this project, if I change the size in the combo box, the text size changes and the RadTileViewItem header height adjusts but the content height does not. I want it to. I've worked around this by binding the Row Height to a property that returns a multiplication of the FontSize. I'd prefer a cleaner way if you know of one.
eg.
public double RowHeight
{
    get
    {
        if (CommonFontSize > 0)
            return 50 + (CommonFontSize * 2.5);
        else
            return 200;
    }
}

<Style TargetType="telerik:RadTileView">
    <Setter Property="RowHeight" Value="{Binding Source={StaticResource MyViewModel}, Path=RowHeight}" />
    . . .
</Style>
0
Zarko
Telerik team
answered on 09 May 2012, 04:26 PM
Hi Peter,
The only other workaround I could think of is to set the RowHeight to Auto. This way the size of the items will depend of the size of their content which depends on the height of the TextBlocks (and their height depends on the FontSize).
You could try this and see if it works for you. If you have further questions please feel free to ask.

All the best,
Zarko
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
TileView
Asked by
Peter
Top achievements
Rank 1
Answers by
Zarko
Telerik team
Peter
Top achievements
Rank 1
Share this question
or