chapter 15 wpf windows presentation foundation dr. john abraham professor, utpa

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

Upload: dylan-hodges

Post on 05-Jan-2016

214 views

Category:

Documents


1 download

TRANSCRIPT

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.

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

• In the toolbox there is a section for 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.

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.

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

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

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>

Displaying XML

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

Formatting and Manipulating XML documents

XML documents contain only data

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

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.

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

Programming using XAML

GUI programming

XAML document defines the appearance of Windows Presentation Foundation application.

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>

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

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)