Usman ur Rehman Ahmed's blog

Text Styles for Windows Phone 7

In Windows Phone 7 it is extremelly simple to achieve mutiple levels (nested text items) of display by means of a List Box. This is often a requirements and such a scenario is shown below,

Nested-list-box
The trick here is to set style of each TextBlock control uniquely and set each item style exclusively.  Following eleven styles are possible to be applied on TextBlock using {StaticResources} markup extension as part of Windows Phone 7 default Text Styles (Theme resoruces),

Various-text-block-styles
XAML Code

                    <ListBox x:Name="SearchListBox" Margin="0,112,-12,0" Height="522">

                        <TextBlock Text="Item 1" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextBlockBase}"/>

                        <TextBlock Text="Item 2" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextNormalStyle}"/>

                        <TextBlock Text="Item 3" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextTitle1Style}"/>

                        <TextBlock Text="Item 4" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextTitle2Style}"/>

                        <TextBlock Text="Item 5" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextTitle3Style}"/>

                        <TextBlock Text="Item 6" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextLargeStyle}"/>

                        <TextBlock Text="Item 7" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextExtraLargeStyle}"/>

                        <TextBlock Text="Item 8" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextGroupHeaderStyle}"/>

                        <TextBlock Text="Item 9" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSmallStyle}"/>

                        <TextBlock Text="Item 10" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextContrastStyle}"/>

                        <TextBlock Text="Item11" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextAccentStyle}"/>

                    </ListBox>

Ref: http://msdn.microsoft.com/en-us/library/ff769552%28v=vs.92%29.aspx

(See Text Styles section)

11
To Posterous, Love Metalab