UpdateLayout when a value (fontsize) changes

4 posts, 0 answers
  1. Peter
    Peter avatar
    95 posts
    Member since:
    Mar 2009

    Posted 03 May 2012 Link to this post

    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
  2. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 04 May 2012 Link to this post

    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 >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Peter
    Peter avatar
    95 posts
    Member since:
    Mar 2009

    Posted 06 May 2012 Link to this post

    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>
  5. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 09 May 2012 Link to this post

    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 >>

Back to Top