none
Dynamic Text Size Change

    Question

  • Is there a method to be able to change the text size of your trading card depending on the width of your trading card?

    For example if I have a PivotViewerItemTemplate with width size 400 and I include a title of size 80 to the template, some of the titles are too long that I would have to wrap it, but that makes it look really bad and takes up more space for other thing. Is there a way to detect that the text is too big and resize that title to say font size 60 instead for that item text?

    Thursday, April 26, 2012 4:29 PM

Answers

  • For example if I have a PivotViewerItemTemplate with width size 400 and I include a title of size 80 to the template, some of the titles are too long that I would have to wrap it, but that makes it look really bad and takes up more space for other thing. Is there a way to detect that the text is too big and resize that title to say font size 60 instead for that item text?

    Hi

    Yes, this is possible...in the PivotViewerItemLayout, add a "ItemsControl" control with its "ItemsSource" property set to use Binding & Converter to achieve this. In the Converter, get the selected item's details (obtained by PivotViewer.SelectedItem property) and generate a Grid/StackPanel control to populated in desired format and return as output.

    This is tried & tested method...I wont be in a place to give a sample, but if you have any coding questions, you can ask me.

    Cheers!

    Wednesday, May 02, 2012 10:16 AM

All replies

  • Hi,

    As far as I know you cannot change the font size for the single one.

    For the PivotViewer doesn't provide the api for this function.

    Ho yes, sorry for answering wrong.

    As akshayakrsh said, you can add a ItemsControl to PivotViewerItemLayout.

    You can create your own control with the dynamic text size function and add it as ItemsControl .

    Monday, April 30, 2012 12:22 AM
  • For example if I have a PivotViewerItemTemplate with width size 400 and I include a title of size 80 to the template, some of the titles are too long that I would have to wrap it, but that makes it look really bad and takes up more space for other thing. Is there a way to detect that the text is too big and resize that title to say font size 60 instead for that item text?

    Hi

    Yes, this is possible...in the PivotViewerItemLayout, add a "ItemsControl" control with its "ItemsSource" property set to use Binding & Converter to achieve this. In the Converter, get the selected item's details (obtained by PivotViewer.SelectedItem property) and generate a Grid/StackPanel control to populated in desired format and return as output.

    This is tried & tested method...I wont be in a place to give a sample, but if you have any coding questions, you can ask me.

    Cheers!

    Wednesday, May 02, 2012 10:16 AM