socal code camp_usc

Post on 30-Jun-2015

998 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

WPF Styling Architecture

About me

• Sr. Consultant at Neudesic• 12 years experience of Microsoft

technologies• Currently working on WPF and WCF• Blog posts on mnabeelkhan.blogspot.com

Agenda

• What is meant by styles• Why we need styles• Key Concepts• Steps in generating a style • Demo• Questions

What is meant by Style

• Features that allow developers and designers to create visually compelling effects and to create a consistent appearance for the product (MSDN).

• A convenient way to apply a set of property values to more than one element (MSDN).

Why we need styles

• Flexibility• Reduce the amount of core code• Accessibility• Separation of Layout from Content.

Different Type of Styles

• Inline styles.• CSS• WPF Styles Architecture.

Inline StylesExample

<ListBox ItemsSource="{Binding Source={StaticResource MyPhotos}}" Background="Silver" Width="600" Margin="10" SelectedIndex="0"/>

Inline StylesDisadvantages

• Style information is provided for each control.• Lacking flexibility. • Cannot use as library between different

projects.• Maintainability – Very difficult to maintain as

changes had to be broad.• No separation between layout and Content.

WPF Styling Architecture

Style Flow

Styles ArchitectureKey points

• Theme is at the top level.• Theme consists of different Control Styles

that are building block for a theme.• Each Control Style consists of General

style, Layout style and fonts.• General Style consists of brushes.• Brushes consists of primitive colors.

Styles ArchitectureAdvantages

• Layout and content style is separated.• Several themes can be developed that have

similar structure.• Themes can be used cross applications as

Style libraries.• Flexibility• Easily maintainable.• Easy to make simple changes.

WPF Styles Architecture

• Demo

WPF Styles Architecture

• Questions

Contact

• http://mnabeelkhan.blogspot.com/• mnabeekhan@gmail.com

top related