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

Slides:



Advertisements
Similar presentations
Unit 02. ASP.NET Introduction HTML & Server controls Postbacks Page Lifecycle.
Advertisements

Information System Design Lab 5&6. User Interface Design.
Expression Blend 4 – deep dive
Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
Creating Windows Store Apps. 1. Overview of Windows Store applications 2. Worked example 3. Adding controls and event handlers Contents 2.
The Microsoft Technical Roadshow 2006 Windows Presentation Foundation (WPF) Marcus Perryman
Introduction to Windows Presentation Foundation (WPF) Dr. Frank McCown COMP 445 – GUI Programming.
Dinko Jakovljević Microsoft Student Partner | BambooLab
© by Pearson Education, Inc. All Rights Reserved.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
An Introduction To Silverlight Gergely Orosz
Windows Presetation Foundation (WPF) 1. Introduction.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 3-1 of…
Slide 1 ICS 012 Visual Programming I Ahmed Esmat Second.
Building Silverlight Applications Using the MVVM pattern An Introduction by Peter Messenger Senior Developer – Qmastor
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
.NET Database Technologies: Introduction to WPF and Entity Framework DataBinding.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Rujchai Ung-arunyawee Department of Computer Engineering Khon Kaen University.
Microsoft Visual Basic 2005: Reloaded Second Edition
Module 11 Control Customization. Module Overview Overview of Control Authoring Creating Controls Managing Control Appearance by Using Visual States Integrating.
An Introduction to Silverlight Matt Harrington Developer Evangelist, Microsoft October 20, 2011.
INSPIRING CREATIVE AND INNOVATIVE MINDS Module 4: Adding Code to a Microsoft ASP.NET Web Form Implementing Code-Behind Pages Adding Event Procedures to.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
Windows Presentation Foundation Adam Calderon Principal Engineer Interknowlogy LLC
Session 08: Architecture Controllers or Managers Graphical User Interface (GUI) FEN AK - IT Softwarekonstruktion.
JSF Introduction Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Object Oriented Software Development 9. Creating Graphical User Interfaces.
Module 12 Attached Properties and Behaviors in WPF.
Graphical User Interfaces Tonga Institute of Higher Education.
Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Windows Presentation Foundation Ruwan Wijesinghe.
Windows Presentation Foundation Maximilian Knor Developer Evangelist Developer and Plattform Group Microsoft Österreich
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Module 1 Windows Client Application Design. Module Overview Windows Client Technologies Architectural Patterns.
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
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.
Windows Presentation Foundation (WPF). Introduction Separates appearance of user interface from behavior Appearance usually specified by XAML Behavior.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
Module 14 Application Settings, State, and Life Cycle.
Module 3 Designing and Developing a User Interface.
Windows 10 UWP MVVM In Depth
Module 4: Creating a Web Application with Web Forms
Module 4 Taking Control of the User Interface. Module Overview Sharing Logical Resources in an Application Creating Consistent User Interfaces by Using.
CPSC 481 – Week #7 Sowmya Somanath
Module 1 Introducing C# and the.NET Framework. Module Overview Introduction to the.NET Framework 4 Creating Projects Within Visual Studio 2010 Writing.
Model View ViewModel Architecture. MVVM Architecture components.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Windows Presentation Foundation Ruwan Wijesinghe.
Programming with MVVM Miguel A. Castro Architect -
Part of the Microsoft.NET Framework 3.0 Tomer Shamam.NET Technologies Expert Sela Group
Working in a Mobile App Development Environment Lesson 2.
Adam Schultz MVVM and WPF. MVVM Model, View, ViewModel A software architecture designed to separate out User Interface design, Business Logic, and Data.
Dive Into® Visual Basic 2010 Express
Real world Windows Phone development
Computing with C# and the .NET Framework
Working in the Forms Developer Environment
Computing with C# and the .NET Framework
Important New Concepts In WPF
XAML User Interface Creation in C#
Module 1: Getting Started
WPF AKEEL AHMED.
Understanding the Visual IDE
Module 10: Creating a Web Application with Web Forms
Web Development Using ASP .NET
ASP.NET MVC Imran Rashid CTO at ManiWeber Technologies.
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
Brown Bag Seminar Summer 2007
Presentation transcript:

Module 1: Creating an Application by Using Windows Presentation Foundation Overview of WPF Creating a Simple WPF Application Handling Events and Commands Navigating Between Pages

What Is WPF? It is a new foundation for building Windows-based applications by using: Media Documents Application UI.NET Framework 4.0 Windows Presentation Foundation (WPF) Windows Presentation Foundation (WPF) Windows Communication Foundation (WCF) Windows Communication Foundation (WCF) Windows Workflow Foundation (WF) Windows Workflow Foundation (WF) Windows CardSpace (WCS) Windows CardSpace (WCS)

Defining User Interfaces in WPF... Label TextBox RadioButton CheckBox Button... Label TextBox RadioButton CheckBox Button

WPF Capabilities and Features WPF provides the following capabilities and features: XAML-based user interfaces Page layout management Data binding 2-D and 3-D graphics Multimedia Animation Documents and printing Security Accessibility Localization Interoperability with Windows Forms controls

WPF Application Types Stand-Alone Applications XAML Browser Applications (XBAPs)

Defining the Application <Application xmlns:x=… xmlns=… x:Class="MyApp.App" StartupUri="Window1.xaml"> … <Application xmlns:x=… xmlns=… x:Class="MyApp.App" StartupUri="Window1.xaml"> … Visual Studio generates a XAML application file that specifies: The code-behind class for the application The startup window or page Application-wide resources

Defining Windows A stand-alone application contains windows or pages They are represented by elements in the XAML file The code-behind file contains event-handler code < Window xmlns:x=… xmlns=… x:Class="MyApp.Window1" Title="My Window"> … < Window xmlns:x=… xmlns=… x:Class="MyApp.Window1" Title="My Window"> …

Adding Controls Windows and pages contain controls The controls are represented by XAML elements and are examples of these... Click here... Click here...

The WPF Event Model WPF controls generate events such as: Clicking buttons Entering text Selecting lists Gaining focus

Implement event handler method in the code-behind file Specify an event handler in the XAML file Handling WPF Control Events Click here Click here public void Button1_Click( object sender, RoutedEventArgs e) { MessageBox.Show("Hello WPF"); } public void Button1_Click( object sender, RoutedEventArgs e) { MessageBox.Show("Hello WPF"); }

What Are Routed Events? Root element Child element #1 Child element #2 Leaf element #1 Leaf element #2 Leaf element #2 WPF can route events up or down the element tree Event bubbling: Event routed up element tree Event bubbling: Event routed up element tree Event tunneling: Event routed down element tree Event tunneling: Event routed down element tree Tunnel Bubble Item clicked

Defining Routed Events Example of event bubbling Define leaf elements inside a container element Handle leaf events at the container level Yes No Yes No private void CommonClickHandler(object sender, RoutedEventArgs e) { Button b = e.Source as Button;... } private void CommonClickHandler(object sender, RoutedEventArgs e) { Button b = e.Source as Button;... }

What Are Commands? Commands separate the semantics of an action from its logic Multiple sources can trigger the same command You can customize the command logic for different targets Key concepts in WPF commanding: Commands Command sources Command bindings Command manager Examples of predefined commands: Copy, Cut, and Paste

The WPF Navigation Model Navigate from one page to another page Navigate to a fragment in a page Navigate subcontent frames in a page

Handling Page Navigation Events Page Navigation Request Navigating NavigationProgress Navigated LoadCompleted FragmentNavigation NavigationStopped NavigationFailed

Maintaining State by Using Navigation Services Page1.xaml Page2.xaml Page1.xaml Next Back KeepAlive property FrameworkPropertyMetadata.Journal IProvideCustomContentState

Why Design Patterns? Application development is a murky business Design patterns support move from chaos to order A good pattern aids Design Implementation Testing Maintenance Extension Collaboration Separation of Concerns

MVVM Design Pattern Design Pattern for Application UIs Evolved from MVP and MVC Well suited to developing with WPF Suits WPF core features Data binding Data templates Commands Resources subsystem

MVVM Tiers Bind and Convert data UI Elements with Data Templates Object Model or Data Access Tier View View-Model Model Abstraction of View with Commands

Lab: Creating a WPF Application Exercise 1: Creating a Stand-Alone WPF Application Exercise 2: Handling Events and Commands Exercise 3: Navigating Between Pages Estimated time: 60 minutes

Lab Review Why would you want to inherit your window from the NavigationWindow class? How do you add an event handler to the Click event of a element in XAML? What is the name of the property that you use to configure a b utton to use the NextPage command? What is the name of the event to which you connect a handler if you want to manually determine if a command is allowed to be executed?