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

Similar documents
Introduction to Data Templates and Value Converters in Silverlight

Name of Experiment: Country Database

Weather forecast ( part 2 )

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

Getting Started with Banjos4Hire

Week 8: Data Binding Exercise (Bookstore)

Lecture # 7 Engr. Ali Javed 18th March, 2014

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

var xdoc = XDocument.Load(inStream);

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

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

RadPDFViewer For Silverlight and WPF

1) ItemsSource: it point to collection which has all the objects that will be shown in the list

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

Microsoft Exam TS: Windows Applications Development with Microsoft.NET Framework 4 Version: 58.5 [ Total Questions: 228 ]

CPSC Tutorial 5

EXAM TS:Windows Apps Dev w/microsoft.net Framework 4((C# and VB) Buy Full Product.

Exam Name: TS: Microsoft.NET Framework 3.5, Windows Presentation Foundation Application

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

Hands-On Lab. Using Pivot and Panorama Controls

Name of Experiment: Student Database

Exam Name: TS: Windows Applications Development with Microsoft.NET Framework 4

Lesson 9: Exercise: Tip Calculator

CPSC Tutorial 6

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

Microsoft Exam

WPF and MVVM Study Guides

Week 6: First XAML Control Exercise

Week 7: NavigationView Control Exercise

CPSC Tutorial 5 WPF Applications

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

Building Next Generation GUIs using Microsoft Expression Interactive Designer

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

Yes, this is still a listbox!


RadGanttView For Silverlight and WPF

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

Hands-On Lab. Using Bing Maps

ArcGIS Pro SDK for.net Advanced User Interfaces in Add-ins. Wolfgang Kaiser

FOREWORD WHAT WE CAN LEARN TARGET READER

Authoring Guide Gridpro AB Rev: Published: March 2014

Developing Native Windows Phone 7 Applications for SharePoint

Lab 7: Silverlight API

WebAqua.NET 2.0 White Paper

Sparkline for WPF 1. ComponentOne. Sparkline for WPF

CS3240 Human-Computer Interaction Lab Sheet Lab Session 2

Course 2D_SL: 2D-Computer Graphics with Silverlight Chapter C1: The Intro Project

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

WebFront for Service Manager

ComponentOne. Extended Library for UWP

Migrating to Windows Phone

Portable Class Libraries ---

ComponentOne. HyperPanel for WPF

Authoring Guide v2.1 PATRIK SUNDQVIST

ArcGIS Pro SDK for.net: Advanced User Interfaces in Add-ins. Wolfgang Kaiser

Pro Windows 8.1. Development with. XAML and C# Jesse Liberty. Philip Japikse. Jon Galloway

Microsoft Corporation

Implementing MVVM in Real World ArcGIS Server Silverlight Applications. Brandon Copeland LJA Engineering, Inc.

The parallel development of a Silverlight application on multiple devices

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

CODE Framework: Writing MVVM/MVC WPF Applications

Programos gyvavimo ciklas

Course 2D_SL: 2D-Computer Graphics with Silverlight Chapter C5: The Complete Code of PathAnimation. Copyright by V. Miszalok, last update:

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to

CS3240 Human-Computer Interaction

Copyright Soyatec. Licensed under the Eclipse Public License 1.0

Index. Windows 10 running, 199 suspended state, 199 terminate apps,

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

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

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

Building Extensible XAML Client Apps

Programming Languages and Techniques (CIS120)

Media Programming on mobile devices (Windows Phone)

Applied WPF 4 in Context US $49.99 SOURCE CODE ONLINE

Sundew. Application Framework

Hands-On Lab. Hello Windows Phone

Microsoft TS: Silverlight 4, Development. Practice Test. Version: QQ:

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

Exam Name: MCTS: Windows Applications Development with Microsoft.NET Framework 4 Practice Test

Q&A. DEMO Version

Connecting a Silverlight Application to Line-of-Business Information

Windows Phone 8 Game Development

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

Building a mobile enterprise application with Xamarin.Forms, Docker, MVVM and.net Core. Gill

windows-10-universal #windows- 10-universal

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

9.3 Launchers and Choosers. Fast Application Switching and Design. Forcing a Program to be removed from memory

SAMPLE CHAPTER. C# and XAML. Pete Brown MANNING

CPSC Tutorial 9 Blend & Animations

Topics. Windows Phone

PART I: INTRODUCTION TO WINDOWS 8 APPLICATION DEVELOPMENT CHAPTER 1: A BRIEF HISTORY OF WINDOWS APPLICATION DEVELOPMENT 3

WRITING THE MANAGEMENT SYSTEM APPLICATION

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

Hands-On Lab. Windows Phone Navigation and Controls

SOFTWARE REQUIREMENTS ENGINEERING LECTURE # 7 TEAM SKILL 2: UNDERSTANDING USER AND STAKEHOLDER NEEDS REQUIREMENT ELICITATION TECHNIQUES-IV

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

ComponentOne. Document Library for UWP

Windows 10 Development: Table of Contents

03 Model-View-ViewModel. Ben Riga

4/25/ Xamarin. All rights reserved.

Transcription:

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

Instructor s Information Instructor: Engr. Ali Javed Assistant Professor Department of Software Engineering U.E.T Taxila Email: ali.javed@uettaxila.edu.pk Contact No: +92-51-9047747 Office hours: Monday, 09:00-11:00, Office # 7 S.E.D Engr. Ali Javed

Course Information Course Name: Mobile Application Development Course Code: SE-5020 Course Link: http://web.uettaxila.edu.pk/cms/sp2014/semadms/ Engr. Ali Javed

Data Binding 5

One Way Data Binding 6

Two Way Data Binding 7

Creating an Adder class 8

Creating an object to bind to public class AdderClass { private int topvalue; public int TopValue { get { return topvalue; } set { topvalue = value; } } // repeat for bottomvalue } public int AnswerValue { get { return topvalue + bottomvalue;} } 9

The AdderClass 10

Adding Notification Behaviour public interface INotifyPropertyChanged { // Summary: // Occurs when a property value changes. event PropertyChangedEventHandler PropertyChanged; } 11

Silverlight display elements PropertyChanged(this, new PropertyChangedEventArgs("AnswerValue")); 12

Reading back the property public int AnswerValue { get { return topvalue + bottomvalue; } } 13

Demo 14

Binding a class to the xaml xmlns:local="clr-namespace:addingmachine" 15

Mapping a class to a resource <phone:phoneapplicationpage.resources> <local:adderclass x:key="adderclass" /> </phone:phoneapplicationpage.resources> 16

Adding the resource to an element <Grid x:name="layoutroot" Background="Transparent" DataContext="{StaticResource AdderClass}"> 17

Business Objects and Silverlight 18

Binding the top line to AdderClass 19

Applying Data Binding 20

One Way binding for the answer 21

Databinding and the DataContext <TextBox Height="72" HorizontalAlignment="Left" Margin="8,19,0,0" Name="firstNumberTextBox" Text="{Binding TopValue, Mode=TwoWay}" VerticalAlignment="Top" Width="460" TextAlignment="Center" > 22

Databinding and the DataContext // Constructor public MainPage() { InitializeComponent(); } AdderClass adder = new AdderClass(); ContentGrid.DataContext = adder; 23

Demo 24

Session 4.4

Topics

Customer Manager 27

Application Data 28

The Customer class public class Customer { public string Name { get; set; } public string Address { get; set; } public int ID { get; set; } } public Customer(string inname, string inaddress, int inid) { Name = inname; Address = inaddress; ID = inid; } 29

The Customers class public class Customers { public string Name { get; set; } } public Customers(string inname) { Name = inname; CustomerList = new List<Customer>(); } public List<Customer> CustomerList; 30

Sample Data 31

Sample Data string [] firstnames = new string [] { "Rob", "Jim", "Joe", "Nigel", "Sally", "Tim"} ; string[] lastsnames = new string[] { "Smith", "Jones", "Bloggs", "Miles", "Wilkinson", "Brown" }; 32

Sample Data Generator public static Customers MakeTestCustomers() { int id = 0; } 33 foreach (string lastname in lastsnames) { foreach (string firstname in firstnames) { //Construct a customer name string name = firstname + " " + lastname; //Add the new customer to the list result.customerlist.add(new Customer(name, name + "'s House", id)); // Increase the ID for the next customer id++; } } return result;

Displaying a List using a StackPanel 34

Sample Data <StackPanel HorizontalAlignment="Left" Margin="0,0,0,0" Name="customersStackPanel" VerticalAlignment="Top"/> 35

Sample Data foreach (Customer c in customers.customerlist) { TextBlock customerblock = new TextBlock(); customerblock.text = c.name; customersstackpanel.children.add(customerblock); } 36

StackPanel Children 37

Stackpanel Display 38

Adding a ScrollViewer <ScrollViewer> <StackPanel HorizontalAlignment="Left Margin="0,0,0,0" Name="customersStackPanel VerticalAlignment="Top" /> </ScrollViewer> 39

Demo 40

The Silverlight ListBox element 41

The ListBox and Data Binding 42

Binding a Single Item <TextBlock Height="46" HorizontalAlignment="Left" Margin="158,208,0,0" Name="resultTextBlock" Text="{Binding Path=AnswerValue}" VerticalAlignment="Top" FontSize="30" Width="160" TextAlignment="Center" /> 43

Binding Complicated Data 44

Creating a DataTemplate <DataTemplate> <StackPanel> <TextBlock Text="{Binding Name}"/> <TextBlock Text="{Binding Address}"/> </StackPanel> </DataTemplate> 45

Using a DataTemplate in a ListBox <ListBox Name="customerList"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Name}"/> <TextBlock Text="{Binding Address}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> 46

Setting the ItemSource customers = Customers.MakeTestCustomers(); customerlist.itemssource = customers.customerlist; 47

Displaying the ListBox 48

An Improved DataTemplate <DataTemplate> <StackPanel> <TextBlock Text="{Binding Name}" Style="{StaticResource PhoneTextExtraLargeStyle}"/> <TextBlock Text="{Binding Address}" Style="{StaticResource PhoneTextSubtleStyle}"/> </StackPanel> </DataTemplate> 49

Selecting Items in a ListBox 50

Selection Changed Events <ListBox Name="customerList" SelectionChanged="customerList_SelectionChanged"> 51

Selection Changed Events private void customerlist_selectionchanged(object sender, SelectionChangedEventArgs e) { // when we get here the user has selected a customer Customer selectedcustomer = customerlist.selecteditem as Customer; } MessageBox.Show(selectedCustomer.Name + " is selected"); 52

Demo 53

Reference http://www.techopedia.com/definition/24291/isolated-storage-net http://msdn.microsoft.com/en-us/library/3ak841sy(v=vs.110).aspx Engr. Ali Javed 54

For any query Feel Free to ask Engr. Ali Javed 55