locked
is it good to hard code the font size of xaml UI controls like titles & headers in windows phone 8.1 apps?

    Question

  • i am developing a windows phone 8.1 app & i had added a pivot to it, i hardcoded the fontsize of pivot title as fontsize=40, is it good practise to do so or is there any other recommended method to set fontsize??
    Wednesday, September 17, 2014 12:17 PM

Answers

  • Hardcoding constants is almost always a bad idea.

    For xaml control properties you can set things like don't size in a style and then apply the style.

    For most cases you can use the standard styles to get the recommended look for your pivot, but you can define your own if you need cousin behavior.

    • Marked as answer by kranthi88 Saturday, September 20, 2014 12:27 PM
    Wednesday, September 17, 2014 1:16 PM
    Owner

All replies

  • Hardcoding constants is almost always a bad idea.

    For xaml control properties you can set things like don't size in a style and then apply the style.

    For most cases you can use the standard styles to get the recommended look for your pivot, but you can define your own if you need cousin behavior.

    • Marked as answer by kranthi88 Saturday, September 20, 2014 12:27 PM
    Wednesday, September 17, 2014 1:16 PM
    Owner
  • Hard coding this in xaml is not recommended you should use relative positioning as well as predefined fonts but if necessary you can change this all but try to use relative position cause font size won't make a big difference but in some cases margins causes a lot of problems

    Muhammad Asad.

    Microsoft Student Partner.

     

    Asad

    Wednesday, September 17, 2014 3:27 PM
  • i was worrying that if i hard code font size as 40 for a pivot title, it may look different in different windows phone devices(does the title automatically scale for different resolutions or should i follow any alternate work around to solve this issue ?)
    Thursday, September 18, 2014 8:53 AM
  • See Supporting multiple screen sizes for suggestions on handling scaling.

    Setting your font sizes in styles is recommended for maintainability, but you can set the style's size to 40 and it should scale appropriately in most cases ("appropriate" being an app specific concept).

    --Rob

    Thursday, September 18, 2014 11:20 PM
    Owner
  • Further more in silverlight pivot app won't allow user to change the font of header. So you cannot change header size its predefined.

    I hope this will help you.


    Asad

    Friday, September 19, 2014 6:18 AM