Expression Blend 4 – deep dive

Slides:



Advertisements
Similar presentations
Module 1: Creating an Application by Using Windows Presentation Foundation Overview of WPF Creating a Simple WPF Application Handling Events and Commands.
Advertisements

Brown University Swim Center
Microsoft SharePoint 2010 technology for Developers
Understanding the MVVM pattern
Silverlight Presenter: Kevin Grossnicklaus February 25 th, 2010.
Dinko Jakovljević Microsoft Student Partner | BambooLab
An Introduction To Silverlight Gergely Orosz
Scenario Fixed look with some logic Split large page into smaller chunks Reuse xaml/logic in multiple places Platform Support … … public partial.
Windows Presetation Foundation (WPF) 1. Introduction.
Gustavo Cavalcanti tinyfit.com. About me... Programmer since mid-90s BS in Computer Science (Catholic University of Pernambuco, Brazil) MBA with emphasis.
Customizing XAML Skins for PowerBuilder.NET WPF Applications
A Good UX How To Make It Happen EAE 4023, UNITE 2010 Tuesday, 9:15 am May 25 th 2010 Niels Gebauer Director Client Tools Consultancy
Discover, Master, InfluenceSlide 1 Introducing Silverlight Paul Stovell Alpha Ape, Lead Code Monkey, Readify.
Real world Windows Phone development Igor
Building Silverlight Applications Using the MVVM pattern An Introduction by Peter Messenger Senior Developer – Qmastor
Shailen Sukul Senior Solutions Architect EMC BSc | Mct | Mcpd (.Net 2/3.5) | Mcts (Sharepoint (MOSS/WSS), Biztalk, Web, Win, Dist Apps) | Mcsd.NET | Mcsd.
Expression Blend Rob S. Miles | Microsoft MVP | University of Hull, UK Andy Wigley | Microsoft MVP | Appa Mundi Session 4.0.
Joe xamlcoder.com/blog Silverlight / WPF Consultant.
Aptech Borivali(West) Hefin Dsouza. Agenda  What is.NET and What is Visual Studio? .NET Framework 3.5 Overview.  Visual Studio 2008 Enhancements. 
Brian Mpafe Microsoft DPE Intern Program.  The Visual Studio IDE  First Application (Hello World)  Second Application(News from Cameroon)
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
READING, WRITING, BINDING, VALIDATING AND VISUALISING YOUR DATA Business value with Silverlight.
.NET Database Technologies: Introduction to WPF and Entity Framework DataBinding.
Introduction to Silverlight. Slide 2 What is Silverlight? It’s part of a Microsoft Web platform called Rich Internet Applications (RIA) There is a service.
1 COS240 O-O Languages AUBG, COS dept Lecture 33 Building Apps Technologies C# (WPF part 1)
Introduction to Mobile Programming. Slide 2 Overview Fundamentally, it all works the same way You get the SDK for the device (Droid, Windows, Apple) You.
An Introduction to Software Architecture
Next Generation for Desktop Applications Doncho Minkov Telerik School Academy schoolacademy.telerik.com Technical Trainer
A Jumpstart to WPF by Kevin Grossnicklaus ArchitectNow.
Windows Presentation Foundation. Agenda Introduction Developing Applications WPF and WF interoperability Custom Controls Styles and Templates Data Binding.
Rudi Grobler Session Code: WUX205.
Windows Presentation Foundation Adam Calderon Principal Engineer Interknowlogy LLC
Silverlight Technology. Table of Contents 1.What is Silverlight Technology? 2.Silverlight Overview. 2.1 How it works 2.2 Silverlight development tools.
1 Metro Style Apps in C++ Karthick 8 th May 2012.
LAYOUT CONTROLS. XAML Overview XAML : eXtensible Application Markup Language pronounced (ZAMEL) is a markup language used to design user interfaces XML-based.
Object Oriented Software Development 9. Creating Graphical User Interfaces.
Ms. Expression Blend Intro Diliara Nasirova. WPF  UI Framework for developing and running.NET programs  It consists of two elements:  A set of DLLs.
Discover, Master, Influence1 Windows Presentation Foundation David Burela Senior Developer, Readify.
A Lap Around Windows Presentation Foundation. Why hasn’t UX taken off in software? It’s Difficult! Animation 2D 3D Documents Styled Controls Video Windows.
ControlTemplate and DataTemplate Doncho Minkov Telerik School Academy Technical Trainer
Windows 10 UWP MVVM In Depth
1 Catching up on Rich Clients (round 1) Mike Ormond, Mike Taulty Developer & Platform Group Microsoft Ltd
Modern Design Principles (MS). Hubs & spoke navigation pattern Hierarchical pattern Best for large collections of related content Content is separated.
Understanding Desktop Applications Lesson 5. Objective Domain Matrix Skills/ConceptsMTA Exam Objectives Understanding Windows Forms Applications Understand.
04 |Sharing Code Between Windows 8 and Windows Phone 8 in Visual Studio Ben Riga
Platform abstractionSeparate UI and logic.
V 1.0 Programming III. XAML Data Binding I.. V 1.0ÓE-NIK, 2014 XAML namespaces Namespaces define the allowed tags and attributes The one without the prefix.
Understanding Desktop Applications Lesson 5. Understanding Windows Forms Applications Windows Forms applications are smart client applications consisting.
Model View ViewModel Architecture. MVVM Architecture components.
Programming with MVVM Miguel A. Castro Architect -
Part of the Microsoft.NET Framework 3.0 Tomer Shamam.NET Technologies Expert Sela Group
Adam Schultz MVVM and WPF. MVVM Model, View, ViewModel A software architecture designed to separate out User Interface design, Business Logic, and Data.
Real world Windows Phone development
DotNetSpider Editor Hefin Dsouza
MVVM Made Simple with Prism
Metropolia 2013 C# programming and .NET framework
Important New Concepts In WPF
6/10/ :23 PM TOOL-504T A deep dive into Visual Studio 11 Express for designing Metro style apps using XAML Joanna Mason & Unni Ravindranathan Program.
Build Windows 10 UWP MVVM Apps with Prism
XAML User Interface Creation in C#
Introduction to Silverlight
WPF AKEEL AHMED.
.NET and .NET Core 7. XAML Pan Wuming 2017.
Silverlight Technology
An introduction to MVVM using WPF NISCHAL S
MIX 09 12/8/2018 4:33 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
An Introduction to Software Architecture
.NET and .NET Core 8. WPF Hierarchy Pan Wuming 2017.
An Introduction to the Model-View-ViewModel Pattern
Brown Bag Seminar Summer 2007
Presentation transcript:

Expression Blend 4 – deep dive Christian Moser User Experience Architect Zühlke Engineering AG www.wpftutorial.net

Microsoft’s vision for XAML (2006) “…XAML rocks because designers can work in tandem with developers…” “…A byproduct of XAML's expressivity and comprehensiveness is true separation of user interface and business logic. “ “…using Blend, a designer can access the full expressivity of XAML – layout, graphics, controls, templating and styling, animations, data binding, and basic 3D.”  http://windowsclient.net/wpf/white-papers/thenewiteration.aspx

A new way of collaboration

Interactive Designer (2006)

Expression Blend (2008)

Expression Studio

The ideal collaboration Developer Designer Connector to backend & business logic Provides data and commands to UI Creates a basic user interface Improves the interaction by arranging and replacing controls Creates (or imports) the visual style

Real world collaboration problems The features of Blend (XAML) are too limited. Code is required to build the desired interaction. The classical way of UI programming (using code behind) is not flexible enough. The designer knows too less about Silverlight or WPF or software architecture. What is a control template, dependency property or trigger? Where to place resources?

Sample Project digitalworld.

The developer’s part for a working collaboration: Separation of Logic and Presentation

How to separate logic and view The model must not know about the view Using DataBinding is the best way to synchronize data between the view and the model Binding to the DataContext is very convenient, since it’s the default source. The DataContext is inherited from parent to child There is only one DataContext To access multiple objects you need to aggregate them to one «facade».

Model-View-ViewModel II DataContext

Advantages of the MVVM pattern The ViewModel defines a clear data contract for the view Through Properties, Lists and Commands Designers can use the contract to create sample data or binding hints Controls can easily be replaced without touching code Developers can test against the ViewModel without creating the view (using UnitTests).

Demo

Designtime vs. Runtime Experience

Typical design time issues At designtime  Wrong size  No data At runtime

At design time UserControls are not embedded in a parent view Width and Height are not set The root-element constructor is not called Root Element is replaced by the designer ViewModel is not created Controls behave different No mouse and keyboard events Design time extensions loaded

Design time attributes xmlns:d ="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup- compatibility/2006" mc:Ignorable="d" Attribute Function d:DesignHeight Overrides the height at design time d:DesignWidth Overrides the width at design time d:DataContext Overrides the data context at design time d:DesignData Creates sample data from a XAML file d:DesignInstance Creates an instance of a type

Design width and height <UserControl xmlns="http://schemas.microsoft.com/..." xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml" d:DesignWidth="640" d:DesignHeight="480" > <UserControl /> Tipp: Blend and Visual Studio provide special handles to set design time size

Generic Sample Data <Application.Resources> <SampleData:ProductSampleData x:Key="data" d:IsDataSource="True"/> </Application.Resources> <Border d:DataContext="{Binding Source={StaticResource data}}" > <ListBox ItemsSource="{Binding Products}" /> </Border>

Sample Data from Type d:DesignData creates a proxy of the specified type and sets the values This brings the following advantages Types without public or default constructor can be created from XAML Readonly properties can be set The designer knows about the interface to support data binding.

Sample Data from Type ProductSampleData.xaml: <l:Product xmlns:l="clr-namespace:DigiShop" Name="HP Notebook" Description= "This powerful device provides…" Price="499.90"> <l:Product.Category> <l:Category Name="Notebooks"/> </l:Product.Category> </l:Product> <StackPanel DataContext="{Binding Products.CurrentItem}" d:DataContext="{d:DesignData ProductSampleData.xaml}" > <Image Source="{Binding Picture}" /> <TextBlock Text="{Binding Name}" /> </StackPanel>

Demo

More Interactivity with less code

XAML limitations Today designers would need to write code to do basic scenarios like: validation drag&drop starting a storyboard Expression Blend features are limited by the expressiveness of XAML A developer needs to support the designer to build these interactions

Selfmade: Attached Helpers <TextBox l:TextBoxHelper.UpdateOnEnter="True" />

Disatvantages of this solution No designer support in Expression Blend You need to start from scratch Register a DependencyProperty to hook up the helper Wiring up to events Handle conditions Detaching and disposing

Actions and Behaviors System.Windows.Interactivity.dll

Hunderts of Behaviors out there InvokeCommandAction CallMethodAction GoToStateAction PlaySoundAction PlayMediaAction RevindMediaAction TogglePlayPauseMediaAction HyperlinkAction SetDataStoreValueAction ChangePropertyAction RemoveElementAction CallDataMethod InvokeDataCommand FluidBindPropertyBehavior DataStateBehavior ClippingBehavior GoToNextStateBehavior ShowMessageBoxBehavior MouseDragElementBehavior FluidMoveBehavior FluidMoveSetTagBehavior TextBoxEditMaskBehavior ListBoxAddOne ListBoxRemoveOne http://expressionblend.codeplex.com/

Actions in Action Actions can be attached to any element <Image Source="{Binding Picture}"> <i:Interaction.Triggers> <i:EventTrigger EventName="MouseLeftButtonDown"> <i:InvokeCommandAction Command="{Binding AddToCartCommand}"/> </i:EventTrigger> </i:Interaction.Triggers> </Image>

How to use Behaviors Behaviors can be attached to any element <Image Source="digitalworld.png" > <i:Interaction.Behaviors> <ei:MouseDragElementBehavior/> </i:Interaction.Behaviors> </Image>

Create your own behavior public class MyBehavior : Behavior<FrameworkElement> { protected override void OnAttached() base.OnAttached(); AssociatedObject.MouseEnter += OnMouseEnter; }   protected override void OnDetaching() base.OnDetaching(); AssociatedObject.MouseEnter -= OnMouseEnter; private static void OnMouseEnter(object sender, MouseEventArgs e) MessageBox.Show("It works!");

Demo

States and Transitions

Button (State Machine) States of controls Button (State Machine)

States using Triggers in WPF <Style x:Key="MyButtonStyle" TargetType="{x:Type Button}"> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="White" /> </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter Property="Background" Value="Gray" /> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Opacity" Value="0.5" /> </Style.Triggers> </Style>  

Visual State Manager

All Silverlight and WPF4 controls support states [TemplateVisualState(Name = "ContentFocused", GroupName = "FocusStates")] [TemplateVisualState(Name = "MouseOver", GroupName = "CommonStates")] [TemplateVisualState(Name = "Focused", GroupName = "FocusStates")] [TemplateVisualState(Name = "Checked", GroupName = "CheckStates")] [TemplateVisualState(Name = "Unchecked", GroupName = "CheckStates")] [TemplateVisualState(Name = "Indeterminate", GroupName = "CheckStates")] [TemplateVisualState(Name = "Pressed", GroupName = "CommonStates")] [TemplateVisualState(Name = "Disabled", GroupName = "CommonStates")] [TemplateVisualState(Name = "Unfocused", GroupName = "FocusStates")] [TemplateVisualState(Name = "Normal", GroupName = "CommonStates")] public class CheckBox : ToggleButton { .... }

Easing Functions Make animations feel more natural <DoubleAnimationUsingKeyFrames … > <EasingDoubleKeyFrame KeyTime="0:0:3" Value="370"> <EasingDoubleKeyFrame.EasingFunction> <BounceEase EasingMode="EaseOut"/> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> </DoubleAnimationUsingKeyFrames>

Reasons for Visual State Manager VSM can be attached to any control without code All Silverlight and WPF 4.0 controls support VSM. State transitions are created automatically Supports TransitionEffects and Easing Good support in Expression Blend Additional States can be added States can be switched from externally

Creating custom easing functions class CoolEasingFunction : EasingFunctionBase { protected override double EaseInCore(double normalizedTime) return Math.Abs(Math.Sin(normalizedTime * Math.PI * 2)) * normalizedTime; }   protected override Freezable CreateInstanceCore() return new CoolEasingFunction();

Demo

Summary The way of programming WPF and Silverlight has become more declarative This makes design tools more powerful Designers can do more without the need of writing code Complexity is hidden within smart reusable extensions like VSM or Behaviors The collaboration between designers and developers can be improved.

Want more information? Meet me at the «Ask the Expert» lounge Contact Information: Christian Moser Zühlke Engineering AG Wiesenstrasse 10a 8952 Schlieren +41 79 261 68 14 Mail: moc@zuehlke.com Blog: www.wpftutorial.net Twitter: @moser_christian

Resources The new Iteration http://windowsclient.net/wpf/white-papers/thenewiteration.aspx Design-Time Attributes: http://msdn.microsoft.com/en-us/library/ee839627.aspx PathListBoxUtils http://expressionblend.codeplex.com/releases/view/57990

4/6/2017 11:35 AM © 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.