Windows Presentation Foundation Fabio Santini fsantini@microsoft.com fsantini@microsoft.com .

Post on 26-Mar-2015

227 views 7 download

Tags:

Transcript of Windows Presentation Foundation Fabio Santini fsantini@microsoft.com fsantini@microsoft.com .

Windows Presentation FoundationFabio Santinifsantini@microsoft.comhttp://blogs.msdn.com/fabiosantini

Windows Presentation FoundationFabio Santinifsantini@microsoft.comhttp://blogs.msdn.com/fabiosantini

Agenda

Per iniziarePer iniziare

Introduzione a Windows Presentation Introduzione a Windows Presentation FoundationFoundation

Come funziona ?Come funziona ?

Cos’è XAML ?Cos’è XAML ?

Interactive Designer (Sparkle)Interactive Designer (Sparkle)

Come migrare ?Come migrare ?

EsempiEsempi

Per iniziare …http://msdn.microsoft.com/windowsvishttp://msdn.microsoft.com/windowsvista/getthebeta/default.aspxta/getthebeta/default.aspx

Microsoft Pre-Release Software WinFX Runtime Microsoft Pre-Release Software WinFX Runtime Components - January Community Technology Components - January Community Technology Preview (CTP) (2.4 Mb)Preview (CTP) (2.4 Mb)

Visual Studio 2005 Visual Studio 2005 (anche se si può fare tutto (anche se si può fare tutto a manina)a manina)

Microsoft® Windows® Software Development Kit Microsoft® Windows® Software Development Kit (SDK) for the January 2006 WinFX® Runtime (SDK) for the January 2006 WinFX® Runtime Components Community Technology Preview Components Community Technology Preview (CTP) (1081.8 MB)(CTP) (1081.8 MB)

Microsoft Visual Studio Code Name “Orcas” Microsoft Visual Studio Code Name “Orcas” Community Technology Preview - Development Community Technology Preview - Development Tools for WinFX® (3.6 Mb)Tools for WinFX® (3.6 Mb)

Per iniziare …Se non funziona il setupSe non funziona il setup

Provate a disinstallare Microsoft Provate a disinstallare Microsoft Command Shell (Monad) e il Compact Command Shell (Monad) e il Compact Framework 2.0Framework 2.0

Eseguire il setup chiedendo un log più Eseguire il setup chiedendo un log più completo completo Setup.exe -l*vSetup.exe -l*v

Se non funziona l’elemento Se non funziona l’elemento MediaElementMediaElement

E’ probabile che il setup non sia riuscito a E’ probabile che il setup non sia riuscito a sostiture due dll sostiture due dll dxva2.dlldxva2.dll (DirectX Video (DirectX Video Acceleration 2.0) e Acceleration 2.0) e evr.dllevr.dll (Enhanced (Enhanced Video Renderer)Video Renderer)

http://www.fsantini.net/default.aspxhttp://www.fsantini.net/default.aspx

La nostra prima La nostra prima applicazioneapplicazione

Element SystemElement System

Font SystemFont System

Input SystemInput System

Event SystemEvent System

Property SystemProperty System

Visual SystemVisual System

Composition SystemComposition System

TransportTransport

• Styles, bindings, Styles, bindings, controlscontrols• LayoutLayout• Text layout (PTS)Text layout (PTS)

• GlyphsGlyphs• MetricsMetrics• CacheCache

• Mouse, Keyboard, Mouse, Keyboard, PenPen• CommandsCommands

• Video, AudioVideo, Audio• 2D, 3D, 2D, 3D, AnimationAnimation• Text layout (line)Text layout (line)

• RoutingRouting• Class handlersClass handlers

• Change Change notificationnotification• StorageStorage• ExpressionsExpressions

• RemotingRemoting• Message basedMessage based

• 2D, 3D2D, 3D• Hardware, Hardware, SoftwareSoftware

Step 1: Step 1:

Scriviamo il programmaScriviamo il programma

<ListBox><ListBox>

<Button /><Button />

<Button /><Button />

</ListBox></ListBox>

Step 2: CompiliamoStep 2: Compiliamo

011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001011101001

BAMLBAML

C#/VB/etcC#/VB/etcEXEEXE

Images, etcImages, etc

Step 3: Step 3:

Eseguiamo il Eseguiamo il programmaprogramma

Step 4: Step 4:

Mostriamo i pixelMostriamo i pixel

ListBoxListBox

ButtonButton ButtonButton

ScrollViewerScrollViewer

StackPanelStackPanel

RenderRenderMeasure & ArrangeMeasure & Arrange

CompNodeCompNode

CompNodeCompNode CompNodeCompNode CompNodeCompNode

CompNodeCompNode

CompNodeCompNodeCompNodeCompNode CompNodeCompNode

ListBoxListBox

ButtonButton ButtonButton

ScrollViewerScrollViewer

StackPanelStackPanel

TransportTransport

UI ThreadUI Thread Render ThreadRender Thread

DX SurfacesDX Surfaces

BitmapsBitmaps

CompNodeCompNode

CompNodeCompNodeCompNodeCompNode CompNodeCompNode

Step 5: Step 5:

Comunichiamo con Comunichiamo con l’utentel’utente

ListBoxListBox

ButtonButton ButtonButton

ScrollViewerScrollViewer

StackPanelStackPanel

Mouse Click!Mouse Click!

CompNodeCompNode

CompNodeCompNodeCompNodeCompNode CompNodeCompNode

1.1. User32 gets the messageUser32 gets the message

2.2. WPF converts message to an input reportWPF converts message to an input report

3.3. If input report is a mouse move…If input report is a mouse move…

• Structural hit testing on visualsStructural hit testing on visuals

• Geometry hit testing through geometry Geometry hit testing through geometry datadata

4.4. Convert reports into one or more eventsConvert reports into one or more events

5.5. For each event… For each event…

• Build event routeBuild event route

• Raise eventsRaise events

Step 6: Step 6:

Utilizziamo gli elementiUtilizziamo gli elementi

Step 7: Step 7: Ritorniamo al punto 4Ritorniamo al punto 4

(ricordate: Mostriamo i pixel)(ricordate: Mostriamo i pixel)

Usiamo XAMLUsiamo XAML

Come migrare ?

Integrazione tra i due mondiIntegrazione tra i due mondi

Un nuovo modo di pensare alle Un nuovo modo di pensare alle interfacceinterfacce

© 2004 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.