CPSC Tutorial 5 WPF Applications

Similar documents
CPSC Tutorial 5

CPSC Tutorial 6

Advanced Programming C# Lecture 3. dr inż. Małgorzata Janik

CPSC Tutorial 9 Blend & Animations

CPSC Tutorial 4 Visual Studio and C#

CPSC Tutorial 4

Step4: Now, Drag and drop the Textbox, Button and Text block from the Toolbox.

Week 8: Data Binding Exercise (Bookstore)

Authoring Guide v2.1 PATRIK SUNDQVIST

WebFront for Service Manager

CS3240 Human-Computer Interaction Lab Sheet Lab Session 3 Designer & Developer Collaboration

Authoring Guide Gridpro AB Rev: Published: March 2014

Week 7: NavigationView Control Exercise

Note: many examples in this section taken or adapted from Pro WPF 4.5 C#, Matthew MacDonald, apress, 2012, pp

CPSC 481 Tutorial 4. Intro to Visual Studio and C#

IAP C# Lecture 5 XAML and the Windows Presentation Foundation. Geza Kovacs

sharpcorner.com/uploadfile/37db1d/4958/default.aspx?articleid=cb0b291c-52ae-4b80-a95c- 438d76fa1145

CPSC 481 Tutorial 10 Expression Blend. Brennan Jones (based on tutorials by Bon Adriel Aseniero and David Ledo)

Microsoft Windows Apps Dev w/microsoft.net Framework 4. Download Full Version :

Hands-On Lab. Sensors -.NET. Lab version: Last updated: 12/3/2010

RadPDFViewer For Silverlight and WPF

Lesson 9: Exercise: Tip Calculator

Hands-On Lab. Hello Windows Phone

Note: This demo app created for this lab uses the Visual Studio 2015 RTM and Windows Tools SDK ver

Master Code on Innovation and Inclusion

LAYOUT. Chapter 3 of Pro WPF : By Matthew MacDonald Assist Lect. Wadhah R. Baiee. College of IT Univ. of Babylon

This book was purchased by

RadGanttView For Silverlight and WPF

Windows Presentation Foundation. Jim Fawcett CSE687 Object Oriented Design Spring 2018

User Interface Changes for SYSPRO

Sparkline for WPF 1. ComponentOne. Sparkline for WPF

Hands-On Lab. Building Applications in Silverlight 4 Module 6: Printing the Schedule. Printing the Schedule

Week 6: First XAML Control Exercise

CS3240 Human-Computer Interaction Lab Sheet Lab Session 2

ArcGIS Pro SDK for.net UI Design for Accessibility. Charles Macleod

windows-10-universal #windows- 10-universal

Getting Started with Banjos4Hire

Chromatic Remote Control Product Guide Executive Way, Suite A Frederick, MD 21704

Interface Builders and Interface Description Languages

Weather forecast ( part 2 )

Name of Experiment: Country Database

Hands-On Lab. Using Pivot and Panorama Controls

Visão Computacional: Reconhecimento da Mão Humana e Seus Movimentos. Licenciatura em Gestão de Sistemas e Computação. Visão Computacional:

Accurate study guides, High passing rate! IT TEST BOOK QUESTION & ANSWER. Ittestbook provides update free of charge in one year!

Migrating to Windows Phone

New Insights into Process Deviations Using Multivariate. Control Charts

ComponentOne. Extended Library for UWP

WPF Viewer for Reporting Services 2008/2012 Getting Started

Windows Presentation Foundation

WPF Graphics and Multimedia

Portable Class Libraries ---

Name of Experiment: Student Database

ComponentOne. HyperPanel for WPF

Launchers and Choosers Hands-on Lab. Hands-On Lab. Launchers and Choosers. Lab version: Last updated: 12/8/2010. Page 1

Workspace Desktop Edition Developer's Guide. Customize Views and Regions

This tutorial is designed for software developers who want to learn how to develop quality applications with clean structure of code.

Microsoft Corporation

Introduction to Data Templates and Value Converters in Silverlight

Lecture # 6 Engr. Ali Javed 11th March, 2014

Exam sell. Higher Quality Better Service! Certified IT practice exam authority.

ComponentOne. Imaging for UWP

Universal Windows Platform Complete Solution

WPF and MVVM Study Guides

CS3240 Human-Computer Interaction Lab Sheet Lab Session 4 Media, Ink, & Deep Zoom

EXAMGOOD QUESTION & ANSWER. Accurate study guides High passing rate! Exam Good provides update free of charge in one year!


ComponentOne. PdfViewer for WPF and Silverlight

XAML - BUTTON. The Button class represents the most basic type of button control. The hierarchical inheritance of Button class is as follows

TDMobile Architecture & Overview of the TD Mobile IDE. Horst de Lorenzi

CS3240 Human-Computer Interaction

.NET Framework, C# and a little bit of WPF. Ivan Bernabucci University Roma TRE

Silverlight memory board ( Part 2 )

XML Based Layout Managers

LAB 2 CREATING A COMBINED PROPOSAL

Microsoft Visual C# 2010 Step by Step John Sharp (Content Master) ISBN: First printing: April, 2010

CHANNEL9 S WINDOWS PHONE 8.1 DEVELOPMENT FOR ABSOLUTE BEGINNERS

WRITING THE MANAGEMENT SYSTEM APPLICATION

Practical WPF. Learn by Working Professionals

Applied WPF 4 in Context US $49.99 SOURCE CODE ONLINE

Create ruler guides. Create a ruler guide

Tutorial - Hello World

Programming for e-learning Developers

Microsoft CSharp

Fundamentals of XAML and Microsoft Expression Blend

Tips and Techniques for Designing the Perfect Layout with SAS Visual Analytics

Class Test 5. Create a simple paint program that conforms to the following requirements.

KillTest. 半年免费更新服务

Chapter 13: Handling Events

Quick Start - WPF. Chapter 4. Table of Contents

About 1. Chapter 1: Getting started with xaml 2. Remarks 2. Versions 2. Examples 2. Hello World 2. Installation or Setup 3

NE Fundamentals of XAML and Microsoft Expression Blend

About 1. Chapter 1: Getting started with xaml 2. Remarks 2. Versions 2. Examples 2. Installation or Setup 2. Hello World 2

SAMPLE CHAPTER. C# and XAML. Pete Brown MANNING

Microsoft.BrainDump v by.Gabry.53q

WPF Debugging and Performance Succinctly

ROUTED EVENTS. Chapter 5 of Pro WPF : By Matthew MacDonald Assist Lect. Wadhah R. Baiee. College of IT Univ. of Babylon

Nintex Reporting 2008 Help

CMSC434. Introduction to Human-Computer Interaction. Week 10 Lecture 16 Mar 29, 2016 Engineering Interfaces II. Jon

Yes, this is still a listbox!

CSC 355 PROJECT 4 NETWORKED TIC TAC TOE WITH WPF INTERFACE

Transcription:

CPSC 481 - Tutorial 5 WPF Applications (based on previous tutorials by Alice Thudt, Fateme Rajabiyazdi, David Ledo, Brennan Jones, and Sowmya Somanath)

Today Horizontal Prototype WPF Applications Controls Events Design Exercise

1. Horizontal Prototype

Horizontal Prototype

Horizontal Prototype

Horizontal Prototype Presentations Tuesday Mar 7 in tutorial (T01) Thursday Mar 9 in tutorial (T02)

Horizontal Prototype Write-up: Two-page redesign rational (main reasons for change) Screen snapshots of your screens (but not counted towards the two-page count)

Horizontal Prototype Work on it during reading break! Suggestion: Avoid implementation unless it helps show/demo your feature We might iterate on it

2. WPF Applications

What is WPF? WPF Windows Presentation Foundation Helpful for rendering user interfaces in Windows-based applications Good for rapid interface designing can create things like labels, textboxes, buttons, etc

What is WPF? WPF uses XAML (Extensive Application Markup Language) an XML-based mark-up language WPF separates the appearance of the interface (implemented using XAML) from its behaviour (implemented in C#)

Resources MSDN: https://msdn.microsoft.com/en-us/library/ aa970268(v=vs.110).aspx WPF tutorial (Christian Mosers): http://www.wpftutorial.net/

WPF Application

WPF Application

WPF Application - XAML <Window x:class="_481wpf1examples.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> </Grid> </Window> XAML code: MainWindow.xaml C# code: MainWindow.xaml.cs

WPF Application - Layouts The Grid is a layout panel that arranges its child controls in a tabular structure of rows and columns. Its functionality is similar to the HTML table but more flexible

WPF Application - Layouts The StackPanel is simple layout in WPF. It stacks its child elements below or besides each other depending on its orientation. Useful for creating any kinds of lists

WPF Application - Layouts There are others: Dock panel, Wrap panel and Canvas panel

WPF - Grid Layout <Grid Height="320" VerticalAlignment="Bottom"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="38" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="200"/> </Grid.ColumnDefinitions> <Label Grid.Row="0" Grid.Column="0" Content="Name:"/> <Label Grid.Row="1" Grid.Column="0" Content="E-Mail:"/> <Label Grid.Column="1" Grid.Row="0" Margin="3" Content="Sowmya Somanath"/> <Label Grid.Column="1" Grid.Row="1" Margin="3" Content="ssomanat@ucalgary.ca"/> </Grid>

WPF - StackPanel Layout <StackPanel> <TextBlock Margin="10" FontSize="20">How do you like your coffee?</textblock> <Button Margin="10">Black</Button> <Button Margin="10">With milk</button> <Button Margin="10">With Sugar</Button> </StackPanel>

WPF - Buttons Drag and drop from TOOLBOX onto the main screen in MainWindow.xaml XML Code: <Grid> <Button Content="Click Here" HorizontalAlignment="Left" Margin="101,123,0,0" VerticalAlignment="Top" Width="210" Height="90"/> </Grid>

WPF - Labels <Grid> <Button Name="button1" Content="Click Here" HorizontalAlignment="Left" Margin="101,123,0,0" VerticalAlignment="Top" Width="210" Height="90" Click="Button_Click"/> <Label Name="label1" Content="Label" HorizontalAlignment="Left" Margin="101,70,0,0" VerticalAlignment="Top" Width="210"/> </Grid>

WPF - Event Handling Double click on your button, and it should redirect you to MainWindow.xaml.cs: private void Button_Click(object sender, RoutedEventArgs e) { } This is an event handler for button click. Events are messages constantly sent by the visual elements to your main program.

Event Handling - Button Events Button

Button Exercise Add MouseEnter and MouseLeave events to your button Change label s content with appropriate messages

Button Exercise <Label Name="label1" Content="" HorizontalAlignment="Left" Margin="164,112,0,0" VerticalAlignment="Top" Width="210"/> <Button Content="Button" HorizontalAlignment="Left" Height="100" Margin="103,159,0,0" VerticalAlignment="Top" Width="308" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave"/> private void Button_MouseEnter(object sender, MouseEventArgs e) { label1.content = "Mouse Enter"; } private void Button_MouseLeave(object sender, MouseEventArgs e) { label1.content = "Mouse Leave"; }

Radio Box Exercise

Radio Box Exercise private void radial1_checked(object sender, RoutedEventArgs e) { bool radial1val = radial1.ischecked.value; if (radial1val == true) { label1.content = "Apples"; } else { label1.content = ""; } } * Similarly for radiobox2

Image Exercise

Image Exercise Create an Image element: <Grid> <Image HorizontalAlignment="Left" Height="182" Margin="104,55,0,0 VerticalAlignment="Top" Width="271"/> </Grid>

Image Exercise

Image Exercise

Adding Images 1. Create an image control 2. Add your image by Project > Add Existing Item 3. Set the source for that image control

WPF - Visibility Property In MainWindow.xaml.cs in the radio box event handler: private void radial1_checked(object sender, RoutedEventArgs e) { bool radial1val = radial1.ischecked.value; if (radial1val == true) { label1.content = "Apples"; appleimage.visibility = Visibility.Visible; orangeimage.visibility = Visibility.Hidden; } else { label1.content = ""; } } * Similarly for radio box 2.

Design Exercise

Design Exercise Try to create some of the screens from your most-evolved Assignment 1 prototype in WPF This is for practice You don t have to integrate this into your project/portfolio

Next week Reading Break! Work on your Horizontal Prototypes Following week (Feb 27): Horizontal Prototype Feedback session Must attend, bring your group

Thanks! Any questions? You can find me at: kta@ucalgary.ca http://imgur.com/dna5e3p