Presentation Transcript
Introduction to WPF: Introduction to WPF Harjeet Singh
What is WPF?: What is WPF? Windows Presentation Foundation is one of four principal components in .NET 3.0
The others are Windows Communication Foundation (WCF), Windows Workflow Foundation (WF) and Windows Cardspace (WCS) (InfoCard)
WPF is essentially an alternative method for developing Windows based applications
WPF Demos: WPF Demos New York Times Reader
Nostalgia Photo Viewer
WPF vs Windows Forms Development: WPF vs Windows Forms Development WPF has a number of advantages over Windows Forms development which include
Comprehensive Integration – WPF provides a uniform platform for using video, speech, text, 2D and 3D graphics
Resolution Independence – as DPI increases, WPF applications maintain their size exactly
Instead of shrinking, WPF applications merely get sharper
WPF Advantages over Windows Forms Development: WPF Advantages over Windows Forms Development WPF supports hardware acceleration
WPF applications can take advantage of GPUs on Graphics cards for smoother graphics
WPF allows the effective separation of design work (to be performed by Designers) and functionality (to be performed by Developers)
WPF Advantages over Windows Forms Development: WPF Advantages over Windows Forms Development WPF supports a new model for content under which almost any control can host almost any other control
This permits very rich user interfaces as almost any control can support 3D graphics, animations and even videos
WPF supports almost complete scalability
WPF Advantages over Windows Forms Development: WPF Advantages over Windows Forms Development WPF was designed from the ground up for managed code
WPF benefits from 5 years of experience with .NET
Disadvantages of WPF: Disadvantages of WPF At the present time there are certain controls available in Windows Forms for which no WPF equivalent exists
Eg DataGridView and PropertyGrid
The learning curve for WPF is very, very steep
The Future of Windows Forms Development: The Future of Windows Forms Development Adam Nathan, one of the authors of a leading WPF book, has suggested that there will be no further development by Microsoft for Windows Forms beyond Version 2.0 (released in 2005)
WPF and Windows Vista: WPF and Windows Vista WPF does not explicitly require Windows Vista
WPF also will work with Windows XP Service Pack 2 and with Windows Server 2003 SP1
Of course, WPF does require Version 3.0 of the .NET Framework, a free download from Microsoft
.NET Framework 3.0 is automatically included with Windows Vista
WPF and Windows Vista: WPF and Windows Vista There are some relatively minor features of WPF which are only supported on Windows Vista
3D objects only get anti-aliasing on Windows Vista or later
Non-rectangular or translucent windows only get hardware acceleration on Windows Vista or later
WPF and XAML: WPF and XAML XAML is a declarative programming language designed for constructing and initializing .NET objects
XAML code is principally the textual representation of some visual element – either a graphic object or a user interface object such as a button or a combo box
WPF and XAML: WPF and XAML Under the standard paradigm the User Interface is described in XAML and the underlying functionality is built using C# (or Visual Basic.NET)
However, using Markup Extensions Microsoft has cleverly been able to build a considerable degree functionality into XAML
Usually when things can be expressed in either C# or XAML, XAML is more terse
Demo: Demo Huntress Demo (Graphic image)
AllXAMLClock (Animation)
XAML User Interface Example
CS User Interface Example
What is WPF/E: What is WPF/E WPF/E stands for WPF Everywhere
WPF/E is basically a Microsoft equivalent for Macromedia Flash
Currently only in beta form, WPF supports Firefox and Internet Explorer 7 on Windows and Firefox and Safari on the MAC
WPF/E Demo: WPF/E Demo PageTurn
Microbe – The city where WPF/E and Flash live together in harmony
WPF/E and Flash Interactive Example
What is the Relationship Between WPF/E and WPF: What is the Relationship Between WPF/E and WPF WPF/E uses a Javascript control to host content created using XAML
Recall that vector graphics can be expressed in XAML and that WPF has very strong support for animations
Client side event handling is processed using Javascript
Does WPF Apply Only to Windows Based Applications: Does WPF Apply Only to Windows Based Applications Answer: Not entirely
As we have seen the WPF/E branch of WPF is designed for Internet delivery and to be platform independent
Also, XAML Browser applications (XBAPs) are a variation of a WPF application which can run over the Internet
However, there are considerable restrictions on XBAPs
XBAP Limitations: XBAP Limitations XBAPs will only run on Windows
XBAPs require Version 3.0 of the .NET Framework (2.8 MB – 7 minutes on a 56Kb Dialup, 1 minute or less on a decent DSL + time to install)
XBAPs require Internet Explorer 7
Standard on Vista but requires a custom install on Windows XP
XBAP Limitations: XBAP Limitations Because XBAP applications run in a Browser (in the partially trusted Internet Zone), they are denied certain functionality
File I/O is denied
Access to the Registry is denied
XBAP Demo: XBAP Demo PhotoViewer Demo
(Coming Later)
Loose XAML Pages: Loose XAML Pages It is not possible to simply write web pages in XAML and expect clients to view them with their browsers
Loose XAML can only be viewed in a browser under very limited circumstances
Moreover, since a large portion of functionality is implemented via C#, this is unavailable with loose XAML
WPF and ASP.NET: WPF and ASP.NET Given the limitations of XBAPs and Loose XAML pages, there is no doubt that WPF will not have any negative impact on ASP.NET development
What is the Expressions Suite: What is the Expressions Suite The Expressions Suite consists of four designer type applications
Only one of these applications, Expressions Web Designer has been officially released (January, 2007)
The other three releases are currently in beta release (or CTP)
Expressions Web Designer: Expressions Web Designer This product is essentially the successor to Microsoft Front Page
Its principal competitor is Macromedia (Adobe) DreamWeaver
The emphasis by Microsoft for this product is Standards Based web design (XHTML)
This product has nothing at all directly to do with WPF
Expressions Blend: Expressions Blend Expressions Blend is a Visual Studio like tool for designing WPF user interfaces
While Blend is intended for use by Designers, it is sufficiently superior to the equivalent designer in Visual Studio that most Developers will likely use it in conjunction with Visual Studio
Expressions Graphic Designer: Expressions Graphic Designer This product represents Microsoft’s attempt to move into the space occupied by Adobe Illustrator and CorelDraw
Vector Graphics
Graphic Designer uses XAML as its native output language
This, of course, facilitates using these vector graphics in WPF applications
Expressions Media: Expressions Media The latest addition to the Expressions suite
Represents a content management system similar to Adobe Bridge
No direct relationship with WPF
Additional Demos: Additional Demos XcEEd DataGrid
Further Study: Further Study Windows Presentation Foundation – Introduction CIS-019M
Foothill College – Los Altos Hills, CA
Spring Term (April – June) 2007
Available both Online and Face to Face
Also a class on Expressions Blend (Summer 07)