Wednesday, December 04, 2013

Formatting the page title / application name

Have you ever looked at the text at the top of the page in an app and wondered why it didn't look quite right? Let me show you why.
Take a look at the three versions of "SETTINGS" here. They show how the page or application name is often displayed at the top of a page.



The one on the left is how it looks with the default Silverlight page template. The middle one is how it looks in the native settings application. The third is how I've reformatted the TextBlock in Silverlight.
Notice how the default Silverlight template is smaller and lighter than the native one.
Here's how that default template looks.

    <TextBlock Text="MY APPLICATION"
               Style="{StaticResource PhoneTextNormalStyle}"
               Margin="12,0"/>

[Line wrappings added to aid readability here - it's a single line in the template]

Firstly notice the redundant Margin that's specified in XAML. This is identical to the margin that's included in the PhoneTextNormalStyle definition. (For more on what's in the predefined styles see the Theme Resources for Windows Phone on MSDN.) The TextBlock would be displayed identically if the explicit margin definition was removed.
The PhoneTextNormalStyle template is not what we want here.

Here's how to adjust the styling so it looks more appropriate.

    <TextBlock Text="SETTINGS"
               FontFamily="{StaticResource PhoneFontFamilySemiBold}"
               FontSize="{StaticResource PhoneFontSizeMedium}"
               Margin="{StaticResource PhoneHorizontalMargin}"/>

Much better.

But, you may ask, what about the pivot control? That includes a Title template that by default is equivalent to the TextBlock we've been looking at.
In the below image I've added this as a second row on the right hand side. You'll notice it's identical to my above defined adjusted styling.


Make your app look like the native look and feel with the above FontFamily, FontSize and Margin settings. Fix templates, don't just rely on them or assume the defaults provided by the SDK are perfect.


19 comments:

  1. In the below picture I've included this as a second row on the right side part. You'll observe it's similar to my above described modified design. what about the rotate control? That has a Headline design that by standard is comparative to the TextBlock we've been looking at.

    ReplyDelete
  2. Anonymous8:51 pm

    Thanks for the tip. Best wishes.

    ReplyDelete
  3. In line Coach Outlet Online is bringing Michael Kors Outlet unique Coach Factory Outlet to a Toms Shoes USA shoe for Cheap Jerseys Spring/Michael Kors Outlet 2014 Coach Factory Outlet, and this Coach Outlet, it’s a Coach Outlet. The Coach Outlet Sale Sandal Giuseppe Zanotti Outlet.Supermodel mom Coach Factory Outlet was Coach Factory Outlet Online being all kinds of hot this weekend Coach Factory Outlet she Coach Store Online out in a Michael Kors Outlet-turning, Celine Outlet I did, I was Celine Bags possessed by Fitflops Flipflops suit madness.Fitflops USA-there string Michael Kors during Michael Kors Store vacation in Tomss Hoes Bahamas. Fitflop Footwear by her family, the 40-year-old looked happy and relaxed - Fitflops Outlet, uh, did we Fitflops Sandals super hot? - as she Giuseppe Zanotti by the pool.I've Giuseppe Zanotti Designer making my own vanilla extract for years. I love it! It's cost-effective, and in my opinion, Vanilla extract is also (easily) the most used extract in my Prada Outlet , sort of pretty (although it kind of looks like spiders too) tastes way better than imitation vanilla extract.

    ReplyDelete
  4. Anonymous4:29 pm

    This comment has been removed by a blog administrator.

    ReplyDelete
  5. Thanks for sharing this quality information with us. I really enjoyed reading.
    ---
    Signature:
    i like play games juegosjuegos.com | jogos do friv | juegos de matar zombies

    ReplyDelete
  6. I think I need it. Thank you
    ---
    friv 2 | friv2 | friv games

    ReplyDelete
  7. Hello, just wanted to say, I loved this article. It was practical.
    Keep on posting!
    Signature:
    descargar facebook gratis
    descargar facebook
    descargar facebook plus
    descarga facebook

    ReplyDelete
  8. I understand what you bring it very meaningful and useful, thanks.
    Signature:
    facebook entrar iniciar sesion gratis - Sitio Oficial iniciado sesión en Facebook lengua española. facebook entrar rápido, facebook iniciar sesion en tu cuenta de entrar facebook

    ReplyDelete
  9. Thank you for that information you article
    Signature:
    download baixar facebook movel, Facebook movel, baixar facebook movel. Facebook chat, baixar whatsapp gratis, fazer o download baixar whatsapp para Android, iPhone. Últimas Facebook

    ReplyDelete
  10. I am happy to find this post very useful for me.
    Signature:
    Versión en descargar facebook en español descargar a los países hablan Español: Facebook Entrar Agora agora , facebook en español descargar , facebook entrar direto agora

    ReplyDelete
  11. I would like more information about this, because it is very nice., Thanks for sharing.
    Signature:
    The place to play all unblockedgames online. Here you can find every blocked games such as: unblocked games , unblocked games happy , unblocked games 77 ,

    ReplyDelete
  12. This is also a very good post which I really enjoyed reading. It is not everyday that I have the possibility to see something like this.
    agario games , descargar facebook , facebook movel baixar , baixar whatsapp , whatsapp baixar , mobogenie , facebook movel

    ReplyDelete
  13. Welcome, your blog is great. I have read many of your articles. It's very interesting and meaningful, it helps me have more knowledge about life.
    happy wheels game ,
    descargar whatsapp gratis ,
    baixar whatsapp gratis ,
    baixar mobogenie ,
    descargar facebook gratis ,
    descargar whatsapp gratis ,
    descargar whatsapp ,
    baixar whatsapp ,
    descargar whatsapp gratis ,
    mobogenie market ,
    agario skins

    ReplyDelete
  14. I'm happy about everything you bring it very interesting and helpful, thanks
    happy wheels , super smash flash 2 , happywheel

    ReplyDelete