1 / 49

Hardcore WPF (Windows Presentation Foundation)

Hardcore WPF (Windows Presentation Foundation) casey chesnut brains-N-brawn.com Madison .NET 11/06 Source Fundamental demos http://www.brains-n-brawn.com/artifacts/HardcoreWPF.zip /backRow demo http://www.brains-N-brawn.com/backRow/ Which of these would you like to see?

issac
Download Presentation

Hardcore WPF (Windows Presentation Foundation)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Hardcore WPF (Windows Presentation Foundation) casey chesnut brains-N-brawn.com Madison .NET 11/06

  2. Source • Fundamental demos • http://www.brains-n-brawn.com/artifacts/HardcoreWPF.zip • /backRow demo • http://www.brains-N-brawn.com/backRow/

  3. Which of these would you like to see? brains-N-brawn.com • Pervasive Computing • Tablet PC (MVP 03) • Compact Framework (MVP 04) • Advanced Web Services (MVP 05) • Media Center (MVP 06) • Speech • Location Based Services • Artificial Intelligence • 3D

  4. OUTLINE • Overview • Fundamentals – demos! • Application Models • /backRow demo!

  5. OUTLINE : Overview

  6. Which of these have you worked with? Now • GDI (20 years), GDI+, WinForms • DirectX (11 years), Direct3D • Quartz, DirectShow (8 years) • Problems • Showing their age • Each API is different • Mixing APIs is challenging

  7. Next Gen • WPF – replaces GDI • Direct3D – large games, used by WPF • Media Foundation – ultimately will replace DirectShow • MCML –markup language for Media Center Edition applications • XNA – small games

  8. WPF • Compositing • UI, Documents, Media, 3D, Browser, … • Declarative programming with XAML markup • For Designers and Developers • Rewritten from scratch • Built on top of Direct3D • Hardware accelerated • Vector based • Resolution independent (1/96 inch) • Retained graphics

  9. Platforms • Vista • XP SP2 • Server 2003 SP1 • Renders the same on each • Remote Desktop transport • Subsets of WPF (XPS, WPF/E) will make it to other platforms

  10. Tiers • Tier 2 – DirectX 9, Shader 2.0, 128 megs video ram (hardware rendering) • Tier 1 – DirectX 7, 32 megs video ram (mixed hw/sw rendering) • Tier 0 – below (software rendering) • Defaults to 60 fps • Anti-aliasing

  11. Timeline • Pillar of .NET 3.0 • Class libraries built on .NET 2.0 • WPF, WCF, WF, InfoCard • Past Release Candidate • Go-live licenses available • Released with Vista • “Orcas”, .NET 3.X coming after that

  12. Installation • Visual Studio 2005 • .NET 3.0 (pre-installed with Vista) • Runtime • Windows SDK • MSBuild, XAMLPad, samples • Orcas extension for VS 2005 • Visual designer, schemas, project templates

  13. XAMLPad Microsoft Expression Interactive Designer Tools • Windows SDK • XAMLPad, Perforator, UISpy, XPS Conformance, WICExplorer • VS 2005 • Orcas Extensions (beta) • Electric Rain Zam 3D • Mobiform Aurora • Microsoft Expression • Graphics Designer • Interactive Designer • “Orcas”, Cider

  14. OUTLINE : Fundamentals • XAML, Application, Navigation, Layout, Content, Data Binding, Dependency Property, Styles, Templates, Controls, Events, Shapes, Documents, Imaging, BitmapEffects, Animation, Media, Brushes, 3D

  15. HelloWorldXamlPage HelloWorldCodePage XAML • Declarative object instantiation • Not exclusive to WPF • Separates UI and logic • Common language for Designers and Developers • Parallel development • Localization, Branding • Targeted UI (devices, users, …) • Tool support • Supports C# and VB.NET

  16. VS.NET WPF app from scratch DragDrop Cider controls from Toolbox Application • Global • Message handling • App events (e.g. startup, shutdown) • NavigationService • Properties collection • StartupUri

  17. XamlSyntax XAML • Object elements, Attribute syntax • Property elements, Abbreviated syntax • Content syntax • Attached properties, Attached events • Markup extensions • Binding syntax, Resource syntax • Xml Namespaces • Code-behind vs Inline vs Code-only

  18. MainWindowTransparency Window • Window • NavigationWindow • Page

  19. http://localhost/PageNavigation/PageNavigation.xbap Navigation • NavigationWindow and Frame • Hyperlink • NavigationService • URI, fragment support • Events • Journal • PageFunctions

  20. Events • RoutedEvents • Tunneling (Preview*) and Bubbling • ElementTree • Stylus support for Tablet PCs • Attach handler in XAML or Code • Styles/Templates can handle events • Bind to element with Name or x:Name

  21. PanelLayout Layout • Dynamic sizing and positioning • Panels are key • Grid, StackPanel, DockPanel, WrapPanel, Canvas, … • Alignment • Stretch (Size to container) • Left, Right, Center (Size to content) • Margin (parent) and Padding (content) • Overflow • Clip, Wrap, Scroll, Scale

  22. ToolTip Content • Rich Content • ContentControl • HeaderedContentControl • ItemsControl • HeaderedItemsControl

  23. InteropWinForm Interop • HwndSource, HwndHost • Interops with WinForms, Win32, DirectX, … • ActiveX interop is through WinForms interop • Cannot share airspace, so compositing will not work

  24. TwoWayBinding Data Binding • Data models : XML, Objects, DataSets, WCF, LINQ, … • Binding syntax • DependencyProperty • DataContext, DataTemplate • INotifyPropertyChanged, INotifyCollectionChanged • Modes : OneTime, OneWay, TwoWay, OneWayToSource

  25. DependencyProperty • Value depends on some other property • User for DataBinding, Styles, Animation, … • Validation • Inheritance • AttachedProperties • Default values

  26. StyledButton Styles • Similar to CSS • Resources • Setters • Triggers • Inheritance • … Templates • … Animation

  27. TemplateButton Templates • Controls are built based on their functionality • The default template can be changed to radically change how the control renders • The goal is to avoid having to create user drawn controls

  28. VS.NET Toolbox Controls • Comes with a set of standard set of common controls for UI • UserControl • Simple reusable control • Similar to application development • Control • Provides templating • For reuse between many applications

  29. Shapes Shapes • 2D Geometric Shapes • Ellipse • Line • Path • Polygon • Polyline • Rectangle

  30. FlowDocument File – Print - XPS Documents • Flow vs Fixed (XPS) • Packaging • Document viewing • Typography • ClearType • OpenFont • Font can be deployed with an Application • Printing • Annotating

  31. Imaging Imaging • BMP, JPEG, PNG, TIFF, WDP, GIF, ICON • BitmapFrame • Rotation • Image, BitmapImage for XAML • CroppedBitamp, FormatConvertedBitmap • Clipping • Stretching • Metadata

  32. BitmapEffect BitmapEffect • Applied to Visuals • Can be chained • Blur • OuterGlow • DropShadow • Bevel • Emboss

  33. AnimatedButton Animation • Dependency Properties • Animation Types : Double, Color, String, Point, Int32, Path, … • Targets : From, To, By • Time based : duration, repetition, start times, … • Storyboards : pausing, stopping, resume • Key-Frame support

  34. MediaInk Media • Audio • Video

  35. Brushes Brushes • SolidColorBrush • Gradients • LinearGradientBrush • RadialGradientBrush • ImageBrush • DrawingBrush – vector and bitmap • VisualBrush – any Visual!

  36. ThreeD 3D • Basic 3D Support • Viewport3D • Cameras • Models • Materials • Lights • Transforms • Hit Testing • Animations

  37. OUTLINE : App Models • Loose XAML • Windows Application • XBAP / WBA • WPF/E • XPS

  38. Loose XAML • XAML without any code • Opens in IE • Can be dynamically generated

  39. Applications • Windows application • EXE with a Window or NavigationWindow • Installed • Offline and Online • Full access

  40. XBAP / WBA • Hosted in a browser, IE6 and above • Other browsers, FireFox with a plugin • Online only • Internet zone permissions • Embed in webpage using IFrame • Cannot interact with hosting page • Media Center, Sidebar Gadgets

  41. WPF/E • Multiple browsers • Browsers IE5.5+, Mozilla, Firefox, Opera, Safari • Multiple platforms • MS : Win2K+, MAC OS X 10 • 3rd party : Linux, Solaris • Multiple devices • Desktop, PPC, SP

  42. WPF/E • Subset of WPF e.g. no 3D • Shooting for 2 meg runtime install • Object tag for embedding in HTML • WPF + JScript, IL • Public beta bits are late (Q3 06), browser release (1st half 07), device support (2nd half 07)

  43. XPS • XML Paper Specification • Subset of WPF • Fixed immutable layout • Zip format with resources • Viewers can be ported to other platforms • Open package specification • XPS • Vista printer spool format

  44. OUTLINE : /backRow Demo • brains-N-brawn.com/backRow/

  45. Resources • Books • Applications = Code + Markup • Programming Windows Presentation Foundation • XAML in a Nutshell • Forum Windows Presentation Foundation ("Avalon“) • Newsgroup microsoft.public.windows.developer.winfx.avalon

  46. Resources • Webcasts http://sessions.mix06.com • eLearning Developing Rich Experiences with Microsoft® .NET Framework 3.0 and Visual Studio® 2005 • Samples C:\Program Files\Microsoft\SDKs\Windows\v6.0\Samples\WPFSamples.zip

  47. Resources • Sites • http://wpf.netfx3.com/ • WPF Windows SDK Documentation • My Five Day Course For Hitting the WPF Curve/Cliff • www.brains-N-brawn.com/backRow/

  48. Questions

More Related