The developers can utilize the style resources to create styles and use them within the Windows Phone Application. For example , the developers can create a style for the textblock with a key identifier in the app.xaml file and then reuse them in different screens of the application.
How to Create an Explicit Style in Windows Phone 8 ?
To create an explicit style , add the style attribute in the app.xaml file with the key attribute as shown below.
<Application.Resources> <Style x:Key="NewStyle" TargetType="TextBlock"> <Setter Property="FontSize" Value="8" /> </Style> </Application.Resources>
The style for the textblock is given a name with the key attrubute “x:Key=”NewStyle” . To refer to this style for a textblock , use the sample code for the textblock as shown below.
<TextBlock Style="{StaticResource NewStyle}"/>
Leave a Reply