1
Moderne GUI og Silverlight
Windows Presentation Foundation
2
WPF Overview
Traditional
GDI (25 years), GDI+, WinFormsDirectX (16 years), Direct3DQuartz, DirectShow (14 years)
ProblemsShowing their ageEach API is differentMixing APIs is challenging
3
WPF Overview
Next Generation
WPF – replaces GDI/WinFormsDirect3D – large games, used by WPFMedia Foundation – ultimately will replace DirectShow
MCML – markup language for Media Center Edition applicationsXNA – small games
4
WPF Overview
CompositingUI, Documents, Media, 3D, Browser, …
Declarative programming with XAML markupFor Designers and DevelopersRewritten from scratch
Built on top of Direct3DHardware acceleratedVector basedResolution independentRetained graphics
5
WPF Vision
Integrated, vector-based composition engine
Utilizing the power of the PC throughout the graphics stack
Unified approach to UI, Documents, and Media
Integration as part of development and experience
Declarative programmingBringing designers directly into application development
Ease of deploymentAllowing administrators to deploy and manage applications securely
6
XAML
XML for Applications Markup Language
<Button Name="button1">Click Me!
</Button>
Button button1 = new Button();button1.Content = "Click Me!";
7
XAML: Properties
As attributes or elements
<Button Content="Click Me!" Background="LightGreen" />
<Button> <Button.Background> LightGreen </Button.Background> Click Me!</Button>
8
XAML: Attached Properties
<Canvas> <Button Canvas.Top="30" Canvas.Left="40"> Click Me! </Button></Canvas>
9
WPF Layout and Controls
Class hierarchy
10
Layout Controls
StackPanelWrapPanelCanvasDockPanelGrid...
11
Simple Controls
PasswordBoxScrollBarProgressBarSliderTextBoxRichTextBox...
12
Content Controls
ButtonRepeatButtonToggleButtonCheckBoxRadioButtonLabelFrameListBoxItem
StatusBarItemScollBarViewerToolTipUserControlWindowNavigationWindow...
13
Headered Content Controls
ExpanderGroupBoxItemTabItem...
14
Items Controls
MenuContextMenuStatusBarTreeViewListBoxComboBoxTabControl...
15
Lookless Controls
Control implies behaviour
Probably supplies default lookDesigner free to supply new look
16
Styles are about setting properties…
17
Styles
18
Developer or Designer?
Designer Developer