chapter 15 wpf

16
CHAPTER 15 WPF Windows Presentation Foundation Dr. John Abraham Professor, UTPA

Upload: athena-odom

Post on 30-Dec-2015

22 views

Category:

Documents


0 download

DESCRIPTION

CHAPTER 15 WPF. Windows Presentation Foundation Dr. John Abraham Professor, UTPA. Windows Presentation Foundation. It is the framework for all graphics and multimedia. In the past different platforms had to be used to accomplish, video, sound, etc. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CHAPTER 15 WPF

CHAPTER 15 WPF

Windows Presentation Foundation

Dr. John Abraham

Professor, UTPA

Page 2: CHAPTER 15 WPF

Windows Presentation Foundation

• It is the framework for all graphics and multimedia.

• In the past different platforms had to be used to accomplish, video, sound, etc.

• With WPF, it can integrate other platforms into it.

• In the toolbox there is a section for WPF.

Page 3: CHAPTER 15 WPF

XAML (Extensible Application Markup Language)

• In WPF when GUI is added XAML markup statements are created to describe the GUI controls.

• Upon compilation the XAML compiler generates code to create and configure controls based on XAML markup.

• XAML is implemented with XML.

Page 4: CHAPTER 15 WPF

XML

• Standard for describing data

• Data thus described may be exchanged between different applications over the internet.

• XML describes information in such a way both humans and computers can understand.

Page 5: CHAPTER 15 WPF

XML - EXtensible Markup Language.

• XML was designed to describe data and to focus on what data is.– XML tags are not predefined. You must define

your own tags – XML uses a Document Type Definition (DTD) or an

XML Schema to describe the data

• HTML was designed to display data and to focus on how data looks

Page 6: CHAPTER 15 WPF

XML stores data, Does not display

• XML can Separate Data from HTML

• With XML, your data is stored outside your HTML.

• XML is Used to Exchange Data

• With XML, data can be exchanged between incompatible systems

• With XML, financial information can be exchanged over the Internet

Page 7: CHAPTER 15 WPF

An Example XML Document

<?xml version="1.0" encoding="ISO-8859-1"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>

Page 8: CHAPTER 15 WPF

Displaying XML

http://www.w3schools.com/xml/xml_display.asp

Page 9: CHAPTER 15 WPF

Formatting and Manipulating XML documents

XML documents contain only data

May us XSL (Extensible Stylesheet Language) to specify rendering instructions for different platforms.

Page 10: CHAPTER 15 WPF

XSL (Extensible Stylesheet Language)

A group of three technologiesXSL-FO (Formatting Objects)

Vocabulary for specifying formatting

XPath

for effectively locating structures and data in XML documents

XSLT (XSL Transformation)For transforming XML documents into other

documents.

Page 11: CHAPTER 15 WPF

XSLT

SLT is a language for transforming XML documents into XHTML documents or to other XML documents.

http://www.w3schools.com/xsl/xsl_transformation.asp

Page 12: CHAPTER 15 WPF

Programming using XAML

GUI programming

XAML document defines the appearance of Windows Presentation Foundation application.

Page 13: CHAPTER 15 WPF

XAML program 1

<Window x:Class="Window1"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="My Hello Program" Height="300" Width="300"> <Grid Background="Gold"> <Label HorizontalAlignment="Center"

VerticalAlignment="cENTER" FontSize="25"> WELCOME TO WPF </Label> </Grid></Window>

Page 14: CHAPTER 15 WPF

Explanation

• Application.xaml.vb is the code behind class and handles application-level events.

2 standard namespaces must be definedPresentation XAML namespace (Microsoft

presentation site)

Standard XAML namespace (Microsoft xaml site) – this site is assigned to x

Page 15: CHAPTER 15 WPF

WPF Controls

• Presented by elements in XAML markup.

• The root element is a window control (this is similar to the form control in our vb programs)

Page 16: CHAPTER 15 WPF