an introduction to styles and templates in windows presentation foundation wpf
Download
Skip this Video
Download Presentation
An Introduction to Styles and Templates in Windows Presentation Foundation (WPF)

Loading in 2 Seconds...

play fullscreen
1 / 26

An Introduction to Styles and Templates in Windows Presentation Foundation (WPF) - PowerPoint PPT Presentation


  • 451 Views
  • Uploaded on

An Introduction to Styles and Templates in Windows Presentation Foundation (WPF). Adam Calderon – C# MVP Principal Engineer Interknowlogy. What We Will Cover. What Styles are and how to use them How Triggers can be used to replace common UI behavior

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'An Introduction to Styles and Templates in Windows Presentation Foundation (WPF)' - albert


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
an introduction to styles and templates in windows presentation foundation wpf

An Introduction to Styles and Templates in Windows Presentation Foundation (WPF)

Adam Calderon – C# MVP

Principal Engineer

Interknowlogy

what we will cover
What We Will Cover
  • What Styles are and how to use them
  • How Triggers can be used to replace common UI behavior
  • How Templates can be used to skin controls
  • How all of this comes together
session prerequisites
Session Prerequisites
  • General Understanding of XML and XAML
  • Basic knowledge of Microsoft® Windows® Presentation Foundation (WPF)
  • Basic knowledge of WPF Resources

Level 200

agenda
Agenda
  • Styles
  • Triggers
  • Templates
  • Adding Style to an existing application
styles overview of styles
StylesOverview of Styles
  • What are styles?
  • Problems they address
  • Elements that support styles
styles style class properties
StylesStyle Class Properties
  • Key
  • TargetType
  • Setters
    • Property
    • Event
  • Resources
  • Triggers
code example of a style
Code Example of a Style

Some Text

styles extending styles
StylesExtending Styles
  • Order of Precedence
  • BasedOn Property
    • Style-based
    • Element-based
demonstration one

Demonstration One

Styles in Action

agenda10
Agenda
  • Styles
  • Triggers
  • Templates
  • Adding Style to an existing application
triggers overview of triggers
TriggersOverview of Triggers
  • Sets properties in response to end-user actions
  • No code solution to code-based remedies of today
triggers basics of triggers
TriggersBasics of Triggers
  • Property set must be a dependency property
  • Properties reset when trigger dependent property changes back
  • Supports single trigger entries and multiple trigger entries (composite trigger)
  • Supports triggers that are dependent upon data binding and not just standard property binding
demonstration two

Demonstration Two

Triggers in Action

agenda14
Agenda
  • Styles
  • Triggers
  • Templates
  • Adding Style to an existing application
templates overview of templates
TemplatesOverview of Templates
  • Defines visual appearance of controls
  • Out-of-box controls get their visual appearance from Templates
  • Brings together styles and triggers
templates basics of templates
TemplatesBasics of Templates
  • Three types of templates:
    • ControlTemplate
    • ItemsPanelTemplate
    • DataTemplate
  • TemplateBinding links template and control properties
  • ContentPresenter can be used to display controls content
demonstration three

Demonstration Three

Templates in Action

agenda18
Agenda
  • Styles
  • Triggers
  • Templates
  • Adding Style to an existing application
adding style to an application steps
Adding Style to an ApplicationSteps
  • Use Style Setters to change the appearance of the text blocks
  • Use Control Templates to redefine the visual tree of a control
  • Use Data Templates to determine how the data appears
  • Use Triggers to create dynamic user interface (UI)
demonstration four

Demonstration Four

Transforming an Existing Application

session summary
Session Summary
  • Styles are powerful and flexible
  • Triggers eliminate user interaction-based UI coding
  • Controls are more about behavior
  • Control Templates modify visual aspects of controls
for more information
For More Information
  • MSDN® Links

Microsoft Windows® Vista™ development center: http://msdn.microsoft.com/windowsvista/

Microsoft .NET Framework 3.0 for developers: 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/

additional resources
Additional Resources

Applications = Code + Markup

By Charles Petzold,

Microsoft Press®

adam calderon
Adam Calderon
  • More info on InterKnowlogy:www.InterKnowlogy.com
  • Contact Information

E-mail: [email protected]

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
questions and answers
Questions and Answers
  • Submit text questions using the “Ask” button.
  • Don’t forget to fill out the survey.
  • For upcoming and previously live webcasts: www.microsoft.com/webcasts
  • Got webcast content ideas? Contact us at: http://go.microsoft.com/fwlink/?LinkId=41781
  • Today's webcast was presented using Microsoft® Office Live Meeting. Get a free 14-day trial by visiting: www.microsoft.com/presentlive
ad