Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Data Templates, Templates and Styling

Presentation on WPF Topics including Data Templates, Templates in general and Styles.
by

Jaime Mahaffey

on 22 December 2010

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Data Templates, Templates and Styling

WPF Templating Styles Styles Apply a set of property values to an element
Change the appearance of any style-related (read: asthetic) property
Used when you need to have a common set of property values on multiple elements
Default Style element is FrameworkElement. Specify TargetType to style other elements
Style Inheritance Styles can be inherited from other styles. Simply use
the property "BasedOn" in the Style element. Triggers Define a list of setters that are activated when specific condition is met. Property Triggers

Data Triggers

Event Triggers Data Triggers DataTriggers work much like
PropertyTriggers but operate on
any object property instead of
just WPF dependency Property. EventTriggers are hooked up to routed events
and generally spark an animation related
action on the element to which the style applies. Event Triggers Property Triggers IsMouseOver = false IsMouseOver = true Templates It is better practice to store templates
and other large resources as seperate
resource dictionaries. As an example,
we would store our custom Listbox in a
resource dictionary called CustomListBox.xaml
and import it in our App when we want to
instantiate that custom control. Refactoring Control Templates Control templates are XAML "recipe" for a control. We can copy the
contents of a control template and modify it to "reskin" a core WPF
control. Logical Tree Logical Tree vs. Visual Tree Logical tree is a representative tree that describes the
heirarchical composition of a WPF application. Visual tree takes the hierarchical tree and expands its
elements into all visual components. Visual Tree Although you can find the templates for WPF core controls in MSDN
documentation, easiest way is to use Expression Blend.
- Add a control
- Right Click on control -> Edit Template
Template Bindings Used to bind to properties of the
control to which you are applying the template.

Useful when the property is not specific to the aspects you are
customizing. Templates vs. Styles Styles are used to adjust properties of
an element.

Templates can replace the entire visual
tree of an element.

Ex. Use template to replace the background
of a button with an ellipse or path object. Data Templates A chunk of XAML markup that defines how a bound data object should be displayed. Hierarchical Data Templates Templates used for hierarchical data such as TreeViewItem and MenuItem Templates used to override how objects are layed out in a Panel (or any
class derived from Panel). Item Panel Templates
Full transcript