15.11. Styles
Styles in Silverlight 3.0 can now be modified at runtime and support inheritance.
15.11.1. Applying Styles Dynamically
The following code shows how to apply a style to a button at runtime:
myButton.Style=(Style)Application.Current.Resources["MyHorridFuchsiaStyle"];
15.11.2. Style Inheritance
Silverlight 3.0 allows you to create styles that inherit from another style (sort of like CSS) by specifying a parent style in the BasedOn property. The following code creates a style inheriting from MyHorridFuchsiaStyle:
<Style x:Key="HybridStyle" TargetType="Button" BasedOn="{StaticResource MyHorridFuchsiaStyle}"></Style>
15.11.3. Merge Dictionary Support
It is now possible to refer to external resource dictionary files within your application: ...
Get Introducing .NET 4.0: with Visual Studio 2010 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.