Thursday, January 7, 2010

Stylesheet using Silverlight.


In silverlight having different approach to creating styles. also styles can write in app.xaml in silverlight application.
app.xaml is a application resource file. it will shares styles accross all the pages.
also it will maintain all the configuration details.
This is the syntax for creating styles in App.XAML.


<Application.Resources>
<Style x:Key="stTextblock" TargetType="TextBlock"> <
Setter Property="Foreground" Value="Red"/> </Style>
</Application.Resources>

we can call this style accross all the pages and it's applicable only for TextBlock controls.


<Grid x:Name="LayoutRoot" Background="White">
<TextBlock x:Name="txtShow" Style="{StaticResource stTextblock}" Text="Bala">
</TextBlock> </Grid>