A Prologue to Styles and Formats in Windows Presentation Establishment (WPF)

An introduction to styles and templates in windows presentation foundation wpf l.jpg
1 / 26
0
0
1364 days ago, 491 views
PowerPoint PPT Presentation
What Styles are and how to utilize them. How Triggers can be utilized to supplant normal UI ... Essential learning of Microsoft Windows Presentation Foundation (WPF) ...

Presentation Transcript

Slide 1

An Introduction to Styles and Templates in Windows Presentation Foundation (WPF) Adam Calderon – C# MVP Principal Engineer Interknowlogy

Slide 2

What We Will Cover What Styles are and how to utilize them How Triggers can be utilized to supplant basic UI conduct How Templates can be utilized to skin controls How the majority of this meets up

Slide 3

Session Prerequisites General Understanding of XML and XAML Basic information of Microsoft ® Windows ® Presentation Foundation (WPF) Basic learning of WPF Resources Level 200

Slide 4

Agenda Styles Triggers Templates Adding Style to a current application

Slide 5

Styles Overview of Styles What are styles? Issues they address Elements that bolster styles

Slide 6

Styles Style Class Properties Key TargetType Setters Property Event Resources Triggers

Slide 7

Code Example of a Style <Style x:Key="Style1"> <Setter Property="Control.Background" Value="Yellow"/> </Style> <Label Content="Yellow Background" Style="{StaticResource Style1}"/> <Style TargetType="{x:Type TextBlock}"> <Setter Property="FontFamily" Value="Segoe Black"/> <Setter Property="HorizontalAlignment" Value="Center"/> <Setter Property="FontSize" Value="12pt"/> <Setter Property="Foreground" Value="#777777"/> </Style> <TextBlock>Some Text</TextBlock>

Slide 8

Styles Extending Styles Order of Precedence BasedOn Property Style-based Element-based

Slide 9

Demonstration One Styles in real life

Slide 10

Agenda Styles Triggers Templates Adding Style to a current application

Slide 11

Triggers Overview of Triggers Sets properties in light of end-client activities No code answer for code-based cures of today

Slide 12

Triggers Basics of Triggers Property set must be a reliance property Properties reset when trigger ward property changes back Supports single trigger sections and different trigger passages (composite trigger) Supports triggers that are needy upon information authoritative and not simply standard property official

Slide 13

Demonstration Two Triggers in real life

Slide 14

Agenda Styles Triggers Templates Adding Style to a current application

Slide 15

Templates Overview of Templates Defines visual appearance of controls Out-of-box controls get their visual appearance from Templates Brings together styles and triggers

Slide 16

Templates Basics of Templates Three sorts of formats: ControlTemplate ItemsPanelTemplate DataTemplate TemplateBinding joins layout and control properties ContentPresenter can be utilized to show controls content

Slide 17

Demonstration Three Templates in real life

Slide 18

Agenda Styles Triggers Templates Adding Style to a current application

Slide 19

Adding Style to an Application Steps Use Style Setters to change the presence of the content pieces Use Control Templates to reclassify the visual tree of a control Use Data Templates to decide how the information shows up Use Triggers to make dynamic (UI)

Slide 20

Demonstration Four Transforming an Existing Application

Slide 21

Session Summary Styles are intense and adaptable Triggers wipe out client cooperation based UI coding Controls are more about conduct Control Templates adjust visual parts of controls

Slide 22

For More Information MSDN ® Links Microsoft Windows ® Vista ™ improvement focus: http://msdn.microsoft.com/windowsvista/Microsoft .NET Framework 3.0 for designers: http://msdn.microsoft.com/winfx/Windows Presentation Foundation code-named "Avalon:" http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=119&SiteID=1 Other Links Microsoft .NET Framework: http://www.netfx3.com/

Slide 23

Additional Resources Applications = Code + Markup By Charles Petzold, Microsoft Press ®

Slide 24

Adam Calderon More data on InterKnowlogy: www.InterKnowlogy.com Contact Information E-mail: adamc@InterKnowlogy.com Phone: 760-930-0075 x274 Blog: http://blogs.InterKnowlogy.com/AdamCalderon About Adam Calderon Microsoft MVP – C# Microsoft UI Server Frameworks Advisory Council Developer/Author/Speaker

Slide 25

Questions and Answers Submit content inquiries utilizing the "Ask" catch. Keep in mind to round out the overview. For up and coming and already live webcasts: www.microsoft.com/webcasts Got webcast content thoughts? Get in touch with us at: http://go.microsoft.com/fwlink/?LinkId=41781 Today's webcast was displayed utilizing Microsoft ® Office Live Meeting. Get a free 14-day trial by going to: www.microsoft.com/presentlive

SPONSORS