|
ASP.NET v2 introduced a fantastic new feature called Application Themes. Themes separate look and feel from pages and user controls, enabling different styles to be applied to the same web site. 51Degrees.mobi extends Themes by enabling the theme to apply to a web page to be applied at runtime based on the capabilities of the device.
The following excerpt from the configuration file shows all the code that is needed to dynamically pick a theme based on the mobile devices characteristics.
For more information about styling controls for different mobile devices click here.
|
Standard Themes
|
Themes can be used to set a common style across your mobile web application based on device characteristics. Some times greater granularity of control is needed. For example; Android phones have many different screen sizes, where as Windows Phone 7 all use the same screen size.
A new control without a user interface is provided called the Style control. It is used to calculate style information for any 51Degrees.mobi control at runtime for the specific requesting device.
The following example ASP.NET code shows how the Style control is linked to a TextBox control using the new StyleID property.
In the above example the width of the text box changes depending on the width of the screen.
To read more about the Style control from the Developers Guide click here.