wpf 4 what's new @ community tour (cesena)

33
Windows Presentation Foundation 4 Le novità del Framework 4 Mauro Servienti, Microsoft MVP – Visual C# Senior Software Architect @ Gaia em@il: [email protected] blog: http://milestone.topics.it

Upload: mauro-servienti

Post on 07-Dec-2014

312 views

Category:

Technology


3 download

DESCRIPTION

Wpf 4 what's new @ Community Tour (Cesena)

TRANSCRIPT

Page 1: Wpf 4 what's new @ Community Tour (Cesena)

Windows Presentation Foundation 4

Le novità del Framework 4

Mauro Servienti, Microsoft MVP – Visual C#Senior Software Architect @ Gaia

em@il: [email protected]: http://milestone.topics.it

Page 2: Wpf 4 what's new @ Community Tour (Cesena)

Agenda

o Visual Studio: le novità dell’IDE;o I controlli: cosa c’è di nuovo;o I miglioramenti all’engine di Wpf;o Il rapporto con il sistema operativo;o L’interazione con l‘utente;

Page 3: Wpf 4 what's new @ Community Tour (Cesena)

Visual Studio: le novità dell’IDE

I controlli: cosa c’è di nuovo;I miglioramenti all’engine di Wpf;Il rapporto con il sistema operativo;L’interazione con l‘utente;

Page 4: Wpf 4 what's new @ Community Tour (Cesena)

Visual Studio 2010o UserControl in ToolBox;o Caricamento anche in presenza di

errori a design time;o Intellisense in Markup Extensionso Ricerche nella toolbox :-)

Page 5: Wpf 4 what's new @ Community Tour (Cesena)

Poi...o Supporto per StaticResource in

App.xaml;o Una PropertyGrid degna de suo nome:

o Miglior editing delle proprietà;o Gestione delle proprietà come in Blend:

o Extract to resource, Value Source, Reset Value;o Sort by property source

Page 6: Wpf 4 what's new @ Community Tour (Cesena)

...e ancorao Miglioramento delle performaces;o Migliore stabilità;o Ho ancora bisogno di Blend?

o Assolutamente si!o Supporto per il design-time mode;

o d:DataContext rulez :-)

Page 7: Wpf 4 what's new @ Community Tour (Cesena)

I controlli: cosa c’è di nuovo

I miglioramenti all’engine di Wpf;Il rapporto con il sistema operativo;L’interazione con l‘utente;

Page 8: Wpf 4 what's new @ Community Tour (Cesena)

Wpf Controlso DataGrid, DatePicker, Calendar nel

core runtimeo WPF Ribbon post WPF4 (CodePlex)

.

Page 9: Wpf 4 what's new @ Community Tour (Cesena)

Ma non solo...o Bag O'Tricks:

o AnimatingTilePanelo ColorPickero InfoTextBoxo ListPagero NumericUpDowno Revealo TransitionsPresentero TreeMapPanel

As soon as posssible, ScottGu <cit.>:-)

Page 10: Wpf 4 what's new @ Community Tour (Cesena)

I miglioramenti all’engine di Wpf

Il rapporto con il sistema operativo;L’interazione con l‘utente;

Page 11: Wpf 4 what's new @ Community Tour (Cesena)

DynamicObject Bindingo C#4.0 facilita l'interoperabilità con

linguaggi dinamicio Dynamic keyword

o WPF 4.0 supporta il binding verso oggetti dinamicio DynamicObject

Page 12: Wpf 4 what's new @ Community Tour (Cesena)

«Bindable» Run.Texto La proprietà Text di Run è ora una

dependency propertyo Supporta DataBinding, solo OneWay

Page 13: Wpf 4 what's new @ Community Tour (Cesena)

Text Rendering: come eravamoo Normalmente WPF disegna il testo

usando una scala di grigi quando il fondo è trasparente;

o Il container può essere trasparent ma il layer inferiore no;o Risultato non ottimale

Page 14: Wpf 4 what's new @ Community Tour (Cesena)

Text Rendering: what’s newo ClearType per ogni singolo elemento

o RenderOptions.ClearTypeHint="Enabled"

o Viene ereditato da tutto il Visual Treeo Opacity, Clipping, Effetti possono

disabilitarloo TextOptions.TextRenderingMode

o Controlla l'algoritmo di antialiasing usato per il text renderingo Auto, Aliased, GrayScale, ClearType (default)

Page 15: Wpf 4 what's new @ Community Tour (Cesena)

Text Rendering: what’s newo TextFormattin

g Optionso In WPF il testo

renderizzato con font piccoli appariva sfuocato

o TextOptions.TextFormattingMode="Ideal" (default)

o TextOptions.TextFormattingMode="Display" (small text)

Page 16: Wpf 4 what's new @ Community Tour (Cesena)

LayoutRoundingo LayoutRounding

o A causa degli algoritmi di allineamento del motore di rendering alcuni elementi (linee) possono risultare sfuocate.

o LayoutRounding imposta l'allineamento al pixel eliminando il problema

o UseLayoutRounding= " True" (default in Silverlight)

Page 17: Wpf 4 what's new @ Community Tour (Cesena)

Caret/SelectionBrusho CaretBrush e SelectionBrush

o È ora possibile cambiare il colore usato per il caret e la selezione;

o SelectionOpacity imposta l'opacità di SelectionBrush;

Page 18: Wpf 4 what's new @ Community Tour (Cesena)

Cached Compositiono Cached Composition

o Permette di cachare parte del visual treeo Renderizzato inizialmente dalla CPU ma

gestito dalla GPU o Il visual tree può essere dinamicoo Miglioramento delle performanceo BitmapCacheBrush usa un cached bitmap

come image source

Page 19: Wpf 4 what's new @ Community Tour (Cesena)

KeyBinding e MouseBindingo WPF 4.0

o KeyBinding o Command è una dependency propertyo Key e Modifier sono dependency properties

o MouseBindingo Command è una dependency propertyo MouseAction è una dependency property

o Lunga vita a M-V-VM :-)

Page 20: Wpf 4 what's new @ Community Tour (Cesena)

VisualStateManagero Permette di gestire i diversi stati e

relative transizioni di un elemento;o Nato in Silverlight per sopperire alla

mancanza dei Triggers;o Integrato dal WPF Toolkit in

PresentationFramework.dll;o I templates dei controlli non

utilizzano il VisualStateManager

Page 21: Wpf 4 what's new @ Community Tour (Cesena)

Easing Functionso Prima di WPF 4.0 le animazioni

erano Lineari o FrameBased;o Con WPF4 è possibile definire

l'algoritmo usato per la generazione dei valori:o WPF mette a disposizione 11 algoritmi

pronti all'uso;o É possibile definire dei propri algoritmi;

Page 22: Wpf 4 what's new @ Community Tour (Cesena)

Pixel Shaders 3.0o WPF4 supporta la versione 3.0 dei

pixel shaders:o Effetti più sofisticati

o Non è emulabile via software:o L'hardware deve supportare PS 3.0;o RenderCapability:

o .IsPixelShadersVersionSupported(Maj,Min)o .IsPixelShadersVersionSupportedInSoftware(

Maj,Min)

Page 23: Wpf 4 what's new @ Community Tour (Cesena)

WPF 4 XBAP applicationo Le XBAP applications di WPF 4.0

o Supportano Full Trusto Supportano Permission elevations

o Nel FX 3.5 era necessario installare il certificato digitale

o Script Interopo E' possibile far interoperare XBAP con il

browser host

Page 24: Wpf 4 what's new @ Community Tour (Cesena)

Custom Spell Checkero WPF supportava solo il correttore

ortografico predefinito dal S.Oo Ora è possibile estendere il correttore

ortograficoo Sono supportati: Inglese, Francese,

Spagnolo e Tedesco o Tutti gli altri linguaggi sono ignorati... :-(

Page 25: Wpf 4 what's new @ Community Tour (Cesena)

Il rapporto con il sistema operativo

L’interazione con l‘utente;

Page 26: Wpf 4 what's new @ Community Tour (Cesena)

Windows 7: JumpListso WPF4 offre il supporto ai JumpList di

Windows 7o Shortcut elencati nella TaskBar o Nella preview è possibile inserire dei

comandi

Page 27: Wpf 4 what's new @ Community Tour (Cesena)

Focus & File dialogso Finalmente le finestre di dialogo Open

e Save seguono quelle del sistema operativo;

o Motore di gestione del focus completamente riscritto per suppotare scenari complessi (eg. Visual Studio) e facilitarne l’uso;

Page 28: Wpf 4 what's new @ Community Tour (Cesena)

L’interazione con l‘utente

Page 29: Wpf 4 what's new @ Community Tour (Cesena)

Multitouch Supporto WPF 4.0 è la piattaforma ideale per lo

sviluppo di applicazioni toucho No Winform support

o Livello di supporto da parte di Windows 7o Raw Messages

o WM_TOUCH, WM_GESTUREo Gestures

o Astrazione dei messaggi in Gestureso É gestita una singola gesture (Zoom or

Rotate)o Manipulation e Inerthia

o Superset di gestureso Possono gestire più gestures

contemporaneamente 29

Page 30: Wpf 4 what's new @ Community Tour (Cesena)

Multitouch Supporto UI Element e ContentElement espongono

eventi Toucho TouchDown/Up/Leave/Move/Entero Viene passato il device che ha

generato l'evento e il TouchPointo Gli eventi sono attivi by default

Page 31: Wpf 4 what's new @ Community Tour (Cesena)

Manipulation e Inerthiao Manipulation

o Deve essere attivata usando IsManipulationEnabled=true

o Nell'evento ManipulationStarting associare il container che riceverà gli eventi di Manipulation

o Gestire l'evento ManipulationDeltao Inerthia

o Sottoscrivere ManipulationInerthiaStarting

o Impostare i parametri relativi all'inerziao TranslationBehavior, ExpansionBehavior,

Rotation 31

Page 32: Wpf 4 what's new @ Community Tour (Cesena)

Qualche considerazione...

o Wpf 4.0 è una rivoluzione?o no, stavolta l'effort maggiore è stato per

l’IDE; o non si può inventare Linq tutti i giorni

<cit.>o L’assenza di rivoluzioni però dimostra

che è stabile e maturo;o La rivoluzione è in arrivo...:

o Multi-targeting su versioni future;o Side-by-side execution;

Page 33: Wpf 4 what's new @ Community Tour (Cesena)

© 2010 Microsoft Corporation. All rights reserved. Microsoft, Visual Studio, the Visual Studio logo, and [list other trademarks referenced] are trademarks of the Microsoft group of companies.

 The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation.  Because Microsoft must respond

to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. 

MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.