DZone
Mobile Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Mobile Zone > Windows Phone Mango Resources Part 3: Sizes

Windows Phone Mango Resources Part 3: Sizes

Jerry Nixon user avatar by
Jerry Nixon
·
Jan. 06, 12 · Mobile Zone · Interview
Like (0)
Save
Tweet
3.07K Views

Join the DZone community and get the full member experience.

Join For Free

This is part 3 in the Resource series.

  1. Part 1: Themes
  2. Part 2: Colors
  3. Part 3: Sizes
  4. Part 4: Styles



What Sizes are there?

Another handy resource is the built-in size resources. This allows you to scale your fonts with two key benefits:

  1. Your font sizes will resemble the rest of the phone
  2. Your application will be ready for future resolutions

Let’s take a look at what sizes are available:

image_thumb

In the code above do you see how the double value does not match the point value specified in the comment? To understand this, we need to talk about the Silverlight Unit of Measurement.

Silverlight Measuring Units

You may already know that DPI is not the same as Pixels.

MSDN: Not all applications are DPI-aware: some use hardware pixels as the primary unit of measurement; changing the system DPI has no effect on these applications. Many other applications use DPI-aware units to describe font sizes, but use pixels to describe everything else.

Graphics and text at different DPI settings

Silverlight uses Layout Rounding

MSDN: Layout rounding is a concept in Silverlight whereby the Silverlight layout system rounds off any non-integral values that exist at the time of the layout render pass. Layout rounding has an API surface area of just a single API,UIElement.UseLayoutRounding, but the default layout rounding behavior that is built in to the layout system has implications for the visual appearance of your application.

The intention of layout rounding is to prevent subpixel rendering logic from producing antialiasing effects that generally are regarded as a poor visual presentation. One of the most extreme examples of this would be if you had a single-pixel straight black line on exactly a half-pixel boundary of the pixel grid. Subpixel rendering would average the pixels on either side of the .5 division. Instead of a single-pixel line of 100% black, it would render a 2-pixel wide line of 50% gray.


Silverlight Unit == Physical Pixel

Device-independent Pixels are a WPF thing (px (default) is device-independent units (1/96th inch per unit [when printing, rarely on screen])). Silverlight units of measure are physical pixels – meaning the actual pixel on the display.

MSDN: Double typing for the sizing properties in Silverlight is mostly for WPF compatibility. WPF supports a conversion behavior for other unit types, and also supports a device-independent pixel concept that has platform dependencies. Silverlight is cross-platform, and does not support the unit types; therefore, the conversion requirements that exist for WPF and require an underlying Double are seldom relevant in Silverlight programming.


Next: Part 4 – Styles


Source:  http://blog.jerrynixon.com/2011/12/mango-sample-resources-part-3-sizes.html

Windows Phone application Mango (software) Windows Presentation Foundation Cross platform Concept (generic programming) code style Measurement (journal) Printing

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Anypoint CLI Commands in MuleSoft
  • 5 Ways to Optimize Your CQL Queries for Performance
  • The Developer's Guide to SaaS Compliance
  • Implementing Microservices Architectures

Comments

Mobile Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo