Cloud Training (Online)




Windows Phone 8 SDK and Applying Styles in Visual Studio 2012

We generally use the Built-in styles for the Windows Phone controls so that the App is theme aware and looks good in both the dark and the light theme with different accent colors.

For example , the textbox can have the following style

<TextBlock x:Name=”txt1″ Style=”{StaticResource PhoneTextNormalStyle}” />

In the previous version of the Visual Studio , when developing the Windows Phone app , the developer had to type in the complete name of the style or another simple thing was to switch to Blend to add the style.

Windows Phone 8 SDK and Applying Styles in Visual Studio 2012

The Visual Studio 2012 brings in a cool feature that lets you easily apply the styles in the designer .

To add a built in style to an element in Visual Studio , follow the below steps

1. Select the element in the designer and Right click to display the context menu .

2. Click “Edit Style” -> “Apply Resource” and then select the predefined styles from the list as shown in the below screenshot.

3. This will add the selected style attribute to the element.

Senthil Kumar B
Senthil Kumar is a former Microsoft MVP (Most Valuable Professional). He is a Co-Author of the book "Windows 10 Development Recipes using JavaScript and CSS" for Apress Publication. He is a technical presenter, blogger, mentor and a Geek.  Senthil is a regular speaker is various local user groups. He has presented at conferences like Great Indian Developer Summit (GIDS) & Microsoft DevCamps. You can reach out to him via his Twitter handle @isenthil.