Expression Blend for Developers

26
Expression Blend for Developers RDN Dev Day

description

Slide deck of presentation "Expression Blend for Developers" that was run during RDN Dev Day in Melbourne

Transcript of Expression Blend for Developers

Page 1: Expression Blend for Developers

Expression Blend for Developers

RDN Dev Day

Page 2: Expression Blend for Developers

Hello World

Mahesh Krishnan• Principal Consultant• Author: Silverlight 4 for

Dummies• Run VIC.NET Dev SIG & SDDN• [email protected]• @MaheshKrishnan• Blogesh.wordpress.com

Page 3: Expression Blend for Developers

What are we doing?

Type of presentation• Bit of PowerPoint• Lots of Demos• No sales. • No wow demos or 5

minutes demos. • Useful Tips & Tricks.

Page 4: Expression Blend for Developers

Rules

Page 5: Expression Blend for Developers

Have you…?

?

Page 6: Expression Blend for Developers

Agenda

Section #1Intro

Section #2 Layout & Drawing

Section #3 Styles

Section #4 Sample Data

Section #5Controls

Session #1 – Intro and Blend BasicsMorning TeaSession #2 – More BlendLunch

Section #6Animation

Section #7 Behaviors

Section #3 SketchFlow

Section #4 Advanced Features

Section #5Extras + Questions

Page 7: Expression Blend for Developers

What is Expression Blend?

• Primary Tool for Designing User Interfaces

• Visually design UI – Blend creates XAML

• Better user experience than Visual Studio when working UI design

• You still need VS 2010 to do all the developer stuff

Page 8: Expression Blend for Developers

Adoption

Reasons• Positioned as Design

tool• Crashes• Messes with my Xaml• Patterns• Don’t want to learn a

new tool• I’m productive hand

coding Xaml

• Not broadly adopted• More stable now• Let go• Better support• Don’t learn something

different if you don’t need to do something different.

• Learning curve

Page 9: Expression Blend for Developers

Blend vs Visual Studio

• When would you use Expression Blend?– Prototyping UI– User Interface design– Writing small blocks of code– Importing designs from Photoshop and Illustrator– Animation

• When would you use Visual Studio?– Simple UI design– Writing code– Debugging, setting breakpoints, etc– Integrating with other projects (.NET WCF Services,

WCF, ...)

Page 10: Expression Blend for Developers

BLENDWALKTHROUGH

Page 11: Expression Blend for Developers

Styling

• Allows re-use of look and feel across controls:–Color, Font, Margins, etc

• Created as a resource:<Application.Resources> <Style x:Key="Style1" TargetType="TextBlock"> <Setter Property="Foreground" Value="#FFF0D3D3"/> <Setter Property="FontSize" Value="36"/> </Style></Application.Resources>

Page 12: Expression Blend for Developers

Applying a Style

• Set using Style property using the StaticResource mark-up in XAML:

<TextBlock Text="Hello World" Style="{StaticResource Style1}" />

Page 13: Expression Blend for Developers

Skinning or Templating

• Allows you to change the complete appearance of the control

• Like Style, created as a resource:

< Application.Resources> <ControlTemplate x:Key="MyTemplate" TargetType="Button"> <Grid> ... <Rectangle .../> <ContentPresenter ... Content="{TemplateBinding Content}" /> </Grid> </ControlTemplate>< /Application.Resources>

Page 14: Expression Blend for Developers

Applying the template

• Set using Template property using the StaticResource mark-up in XAML:

<Button Content= "Click ME" Template="{StaticResource MyTemplate}" />

Page 15: Expression Blend for Developers

Parts and States Model

• States model breaks the Control down based upon its different states and how it should look for each state

• Parts model breaks the Control down into various parts and how each part should look

Page 16: Expression Blend for Developers

Visual State Manager

• Manages states for a control–Allows setting different State groups

for a control• Manages transition between states–Controls the look and feel of the

control when state transition occurs• Allows designers to define state

transition behaviour (usually done using Animation)

Page 17: Expression Blend for Developers

The Parts Model – an example

Page 18: Expression Blend for Developers

Animation

• Animation is created by quickly cycling through a series of images

• Each image is slightly different from the previous one

• Image is created by changing a (visual) property

• Basic animations works on properties of type:– Double– Color– Point

Page 19: Expression Blend for Developers

Basic Animation

• Storyboard–Container for animation–Manages timeline. Can start, pause,

stop animations• xxxxAnimation (e.g.

DoubleAnimation)– Specify From, To and Duration– Storyboard will do the interpolation

Page 20: Expression Blend for Developers

Basic Animation

• XAML Syntax for Storyboard:

<Storyboard x:Name="MyStoryboard"> <DoubleAnimation Storyboard.TargetName="rect1" Storyboard.TargetProperty="Width" From="40" To="100" Duration="0:0:5"> </DoubleAnimation></Storyboard>

Page 21: Expression Blend for Developers

Key Frame Animation

• Animates between a series of values• Can control their interpolation method–Discrete, Linear, Splined

• Animation classes–xxxxAnimationUsingKeyFrame

(e.g.DoubleAnimationUsingKeyFrame)– Supports Double, Color, Point and Object

Page 22: Expression Blend for Developers

Key Frame Animation

• XAML Syntax for Storyboard:

<Storyboard x:Name="MyStoryboard"> <DoubleAnimationUsingKeyFrames Duration="0:0:4.5" Storyboard.TargetName="rect1" Storyboard.TargetProperty="Width”> <LinearDoubleKeyFrame Value="140" KeyTime="0:0:0"/> <LinearDoubleKeyFrame Value="10" KeyTime="0:0:2.2"/> <LinearDoubleKeyFrame Value="140" KeyTime="0:0:3"/> </DoubleAnimationUsingKeyFrames></Storyboard>

Page 23: Expression Blend for Developers

Behavior

• Reusable piece of functionality• Allows actions to be performed

without writing code– Start an animation– Trigger a state change– Play a sound– etc

Page 24: Expression Blend for Developers

Behavior types

• Action: invoked to perform an operation.– Call a method, open window, etc

• Behavior: operation performed without invoking it–Mouse over operation

• Trigger: fires when something (event) occurs– Timer ends

Page 25: Expression Blend for Developers

TFS Unboxed

Learn what is involved in getting TFS 2010 up and running in your development environmentStephen Godbold & Dr Tafline Murnane

Monday 2 August 2010 Level 5, 4 Freshwater Place, SouthbankAM session: 8:30am – 12:15pmPM session: 1:15pm – 5:00pm $75 + GST (includes light refreshments)

Page 26: Expression Blend for Developers

Questions?