WPF 20 Introduction

50 %
50 %
Information about WPF 20 Introduction
Product-Training-Manuals

Published on June 18, 2007

Author: Spidermann

Source: authorstream.com

Windows Presentation Foundation:  Windows Presentation Foundation Adam Calderon Principal Engineer Interknowlogy LLC adamc@interknowlogy.com http://blogs.interknowlogy.com/adamcalderon The next generation of Windows Forms What is WPF:  What is WPF Windows Presentation Foundation is Microsoft's unified presentation subsystem for Windows, and is exposed through WinFX and XAML. It consists of a display engine and a managed-code framework. Windows Presentation Foundation unifies how Windows creates, displays, and manipulates documents, media, and user interface (UI), enabling developers and designers to create visually stunning, differentiated user experiences What is WinFx:  What is WinFx WinFX is Windows Vista's managed-code programming model, building on and extending the .NET Framework. WinFX offers both practical solutions to today's software challenges and new opportunities to create software and services not possible now. It enables both developers and designers to quickly create new applications and experiences that are more reliable and secure, visually stunning, smarter about information management, better connected, and more collaborative. What is XAML:  What is XAML XAML is a markup language that declaratively represents user interfaces for Windows applications, improving the richness of the tools with which developers and designers can compose and repurpose UI. For Web developers, XAML provides a familiar UI description paradigm. XAML also enables the separation of UI design from the underlying code, enabling developers and designers to work more closely together. Sample XAML:  Sample XAML andlt;Window x:Class='WindowsApplication1.Window1' xmlns='http://schemas.microsoft.com/winfx/avalon/2005' xmlns:x='http://schemas.microsoft.com/winfx/xaml/2005' Title='WindowsApplication1'andgt; andlt;Gridandgt; andlt;Label VerticalAlignment='Top' HorizontalAlignment='Left' Grid.Column='0' Grid.ColumnSpan='1' Grid.Row='0' Grid.RowSpan='1' Margin='32,37,0,0' Width='115.63' Height='23' Name='label1'andgt;Hello Worldandlt;/Labelandgt; andlt;/Gridandgt; andlt;/Windowandgt; WPF Application Types:  WPF Application Types Windows Application Standard single window type Browser navigation type Browser Application Runs in a sandbox with 'Internet Permissions' Layout Basics:  Layout Basics Panels layout children Size to content Alignments Margins Padding Content Overflow Panels – How you layout forms:  Panels – How you layout forms DockPanel Allocates the entire edge of the panel area to each child StackPanel Lays out children in a vertical or horizontal stack Grid Arranges children within a grid Canvas Performs no layout logic. Puts children where you tell it to. Controls:  Controls Events Commands Built-In Controls Control Events (Routed Events):  Control Events (Routed Events) Bubbling Starts at the current element and bubbles up to the current element’s parent and that elements parent and so on [MouseLeftButtonDown] Tunneling Works opposite of bubbling and starts at the root element and works down to the originating element [PreviewMouseLeftButtonDown] Direct Works like standard .NET event handling with only direct handlers being notified of events [Click] Working with Events:  Working with Events Halting Events Private void Grid_ButtonDown(object sender, RoutedEventArgs e) { //do something here e.Handled = true; } Determining the Target Private void Grid_ButtonDown(object sender, RoutedEventArgs e) { // who is the originator MessageBox.Show(((System.Windows.Controls.Control)e.OriginalSource).Name); } Commands:  Commands Logical action that can be invoke in several ways Based on the RoutedCommand Class Uses both event tunneling [PreviewExecuteEvent] and event bubbling [ExecuteEvent] Standard Command Classes:  Standard Command Classes Built-In Controls:  Built-In Controls Not wrappers around old Win32 controls Native WPF controls Support styling, resolution independence, data binding, composition and full support for WPF graphic capabilities Includes Most Standard Controls Buttons Slider and Scroll Text Controls (Textbox, Label) Menus and Toolbars Data Binding:  Data Binding Simple Field level Data Binding Complex Data Binding to multiple controls at a time (Master/Detail/Detail) Client-Side Sorting and Filtering Support for binding to Objects, XML and Relational data sources Simple Data Binding:  Simple Data Binding Simple Data Binding using Business Objects Support for two-way synchronization in simple objects via the INotifyPropertyChanged interface Implicit and Declarative binding via the DataContext Complex Data Binding:  Complex Data Binding Binding to Lists Supports two-way data binding to list if list inherits from ObservableCollectionandlt;Tandgt; Data Templates Sorting Filtering Master/Detail/Detail Multiple Data Sources:  Multiple Data Sources Object Data Source XML Data Source Relational Data Source Styles:  Styles Used for both Elements (Controls) and Data Templates Can be used to set properties (Font) or define the way an object looks Different types: Inline, Named Can target a specific type and can inherited like CSS. Slide20:  Window1.xaml.cs Contains: Application logic Created by: Application developer Window1.xaml Contains: Principal UI (controls, layout, etc.) Created by: Application developer or designer Design Experience: By hand or using a visual tool Styles.xaml Contains: Application 'style' (visual description of UI elements) Created by: Application designer Design Experience: By hand or using a visual tool Laying out files with Styles in Mind Data model, event names, element names, etc. Resource names and element types. Triggers:  Triggers Property Triggers Data Triggers Event Triggers What else is in WPF:  What else is in WPF Control Templates Resources Graphics Annimation Custom Controls Integration with VS2005 Controls ClickOnce Deployment Resources:  Resources Programming Windows Presentation Foundation (by Chris Sells and Ian Griffiths) http://www.amazon.com/gp/product/0596101139/qid=1136144280/sr=8-1/ref=pd_bbs_1/102-9584211-5272153?n=507846andamp;s=booksandamp;v=glance WinFx December CTP http://msdn.microsoft.com/windowsvista/getthebeta/default.aspx Windows Vista Developers Center http://msdn.microsoft.com/windowsvista/default.aspx Windows Presentation Foundation Forum http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=119andamp;SiteID=1

Add a comment

Related presentations

Related pages

WPF Tutorial | Introduction to WPF

Christian Moser's WPF Tutorial. An elaborate tutorial about the Windows Presentation Foundation with hunderts of samples.
Read more

Introduction to WPF

Introduction to WPF ... < Button Margin = " 20 " >