<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>I Blogs di Visual Basic Tips &amp; Tricks</title><link>http://community.visual-basic.it/MainFeed.aspx</link><description /><generator>Subtext Version 2.5.2.0</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/VisualBasicTipsTricksBlogs" /><feedburner:info uri="visualbasictipstricksblogs" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>Il mio libro Visual Studio LightSwitch Unleashed disponibile dal 29 febbraio</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/dFu5ake-jXk/Il-mio-libro-Visual-Studio-LightSwitch-Unleashed-disponibile-dal-29.aspx</link><pubDate>Fri, 24 Feb 2012 10:34:57 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/02/24/Il-mio-libro-Visual-Studio-LightSwitch-Unleashed-disponibile-dal-29.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38063.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38063.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/02/24/Il-mio-libro-Visual-Studio-LightSwitch-Unleashed-disponibile-dal-29.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38063.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">Il mio libro Visual Studio LightSwitch Unleashed disponibile dal 29 febbraio</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;Dopo lunga attesa, sono contento di poter annunciare che il mio nuovo libro &lt;a href="http://www.amazon.com/Microsoft-Visual-Studio-LightSwitch-Unleashed/dp/0672335530/ref=pd_sxp_f_r/188-5901705-7783854#_"&gt;Visual Studio LightSwitch Unleashed&lt;/a&gt; sarà finalmente disponibile a partire dal &lt;font color="#ff0000"&gt;29 febbraio 2012&lt;/font&gt;.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;a target="_blank" href="http://www.lightswitch.it/DesktopModules/ActiveForums/viewer.aspx?portalid=5&amp;amp;moduleid=630&amp;amp;attachid=12"&gt;&lt;img border="0" alt="" src="http://www.lightswitch.it/DesktopModules/ActiveForums/viewer.aspx?portalid=5&amp;amp;moduleid=630&amp;amp;attachid=13" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Mi porto avanti con questa comunicazione atteso che il 29 febbraio sarò a Redmond per l'MVP Global Summit e quindi avrò poco tempo per il blog &lt;img alt="" src="/aspx/providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Il libro sarà disponibile solo in lingua inglese, poichè l'editore non fa anche traduzioni in altre lingue. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Facendo parte della collana &lt;em&gt;Unleashed&lt;/em&gt;, non mi sono smentito e anche stavolta ho prodotto un bel tomo di circa 900 pagine. Ho trattato ogni possibile aspetto dello sviluppo LightSwitch, quanto meno dal punto di vista delle possibilità offerte e della strumentazione attualmente a disposizione.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Prima di annoiarvi con una descrizione, vi invito a scaricare gratuitamente il &lt;a href="http://www.informit.com/content/images/9780672335532/samplepages/0672335530.pdf"&gt;&lt;font color="#ff0000"&gt;contenuto dimostrativo&lt;/font&gt;&lt;/a&gt;, costituito in formato PDF dal Capitolo 3, dall'elenco completo dei capitoli e degli argomenti trattati, dall'indice analitico, dai miei special thanks. Inoltre, andando nella &lt;a href="http://www.amazon.com/Microsoft-Visual-Studio-LightSwitch-Unleashed/dp/0672335530/ref=pd_sxp_f_r/188-5901705-7783854#_"&gt;pagina&lt;/a&gt; del libro su Amazon, cliccando sulla copertina è possibile spulciare ulteriori contenuti di esempio tratti dal volume.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;E' anche inclusa la prefazione di &lt;a href="http://blogs.msdn.com/bethmassi"&gt;Beth Massi&lt;/a&gt;, della quale sono ovviamente onorato. Beth fa parte del team di LightSwitch a Redmond ed ha rivestito la figura di editore tecnico per questo libro. La ringrazio in modo particolare sia per aver accettato la mia richiesta di rivestire quel ruolo, sia perchè attraverso le sue correzioni e i suoi suggerimenti ho potuto imparare davvero molte cose in più e ad ottimizzare determinate parti di codice.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Ci sono 19 capitoli + 2 appendici, organizzati in modo graduale di modo che anche il principiante possa cominciare senza problemi via via arrivando ad argomenti più 'tosti' e destinati a sviluppatori Silverlight e WPF già più esperti.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Si parla di come creare le applicazioni business, sia semplici che complesse, si parla di come implementare la propria business logic, si parla di query, di LINQ, di debug delle applicazioni. Si parla della distribuzione tramite pacchetti di installazione ma anche su server Web aziendali. Si parla di Cloud, descrivendo l'hosting su Windows Azure e l'uso di SQL Azure. Si parla di WCF RIA Services, di SharePoint, di sorgenti dati diverse da SQL Server. Si parla di Team Foundation Server e di source control in LightSwitch. Si parla di estendibilità dell'ambiente e delle applicazioni, in tutti i possibili extensibility points. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Chiaramente ho cercato di trasfondere l'esperienza reale, per cui si parla anche di cose non tipicamente trattate nel materiale didattico, come stored procedure, reportistica tramite extension, integrazione con Office, tips &amp;amp; tricks utili.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Il codice sorgente sarà disponibile, e scaricabile liberamente, entro pochi giorni sul &lt;a href="http://www.informit.com/store/product.aspx?isbn=0672335530"&gt;book site&lt;/a&gt; e sarà sia per Visual Basic che per Visual C#, mentre gli esempi all'interno del libro sono solo in Visual Basic. Tengo a ringraziare in modo particolare coloro che hanno pre-ordinato il libro molto tempo fa e che hanno dovuto attendere così a lungo. Purtroppo i processi su libri di questo genere sono molto articolati e l'autore del libro è solo una parte di un'organizzazione complessa &lt;img alt="" src="/aspx/providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/wink_smile.gif" /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Se avete feedback o altre curiosità inerenti il libro, sarò contento di rispondere all'interno dei forum di &lt;a href="http://www.lightswitch.it"&gt;LightSwitch Tips &amp;amp; Tricks&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38063.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/dFu5ake-jXk" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/02/24/Il-mio-libro-Visual-Studio-LightSwitch-Unleashed-disponibile-dal-29.aspx</feedburner:origLink></item><item><title>Visual Studio 11 Beta e .NET Framework 4.5 Beta in arrivo il 29 febbraio - Sneak Preview</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/VtqTKRCJAB0/Visual-Studio-11-Beta-e-NET-Framework-4-5-Beta.aspx</link><pubDate>Fri, 24 Feb 2012 07:54:25 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/02/24/Visual-Studio-11-Beta-e-NET-Framework-4-5-Beta.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38062.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38062.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/02/24/Visual-Studio-11-Beta-e-NET-Framework-4-5-Beta.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38062.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">Visual Studio 11 Beta e .NET Framework 4.5 Beta in arrivo il 29 febbraio - Sneak Preview</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;Chiaramente in concomitanza con il rilascio della Consumer Preview di Windows 8, il futuro degli sviluppatori su tecnologie Microsoft comincerà a delinearsi il giorno 29 febbraio, data in cui verrà rilasciata la Beta di Visual Studio 11 e .NET Framework 4.5.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Ieri i maggiori rappresentanti della Dev Div a Redmond hanno scritto dei blog post in cui mostrano una serie di screen shot e descrivono alcune delle più innovative caratteristiche di questo prodotto, sebbene in beta.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Vi segnalo quindi:&lt;/font&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;il &lt;a href="http://www.microsoft.com/visualstudio/en-us/visual-studio-11"&gt;Developer Center&lt;/a&gt; di MSDN aggiornato&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;&lt;a href="http://blogs.msdn.com/b/somasegar/archive/2012/02/23/the-road-to-visual-studio-11-beta-and-net-4-5-beta.aspx"&gt;Blog post&lt;/a&gt; di  S. Somasegar&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;&lt;a href="http://blogs.msdn.com/b/jasonz/archive/2012/02/23/sneak-preview-of-visual-studio-11-and-net-framework-4-5-beta.aspx"&gt;Blog post&lt;/a&gt; di Jason Zander&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;&lt;a href="http://blogs.msdn.com/b/visualstudio/archive/2012/02/23/introducing-the-new-developer-experience.aspx"&gt;Blog post&lt;/a&gt; del team di Visual Studio&lt;/font&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Come potete vedere, piaccia o non piaccia Metro is everywhere, ma questo è abbastanza naturale &lt;img alt="" src="/aspx/providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Ci aggiorneremo d'ora in avanti con le novità inerenti il primo passo vero verso la nuova versione dell'ambiente di sviluppo.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38062.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/VtqTKRCJAB0" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/02/24/Visual-Studio-11-Beta-e-NET-Framework-4-5-Beta.aspx</feedburner:origLink></item><item><title>WPF 4.5: novità nel VirtualizingStackPanel</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/10ryjw7aBJ4/WPF-4-5-novita-nel-VirtualizingStackPanel.aspx</link><pubDate>Tue, 21 Feb 2012 16:39:58 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/02/21/WPF-4-5-novita-nel-VirtualizingStackPanel.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38061.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38061.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/02/21/WPF-4-5-novita-nel-VirtualizingStackPanel.aspx#comment</comments><slash:comments>2</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38061.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">WPF 4.5: novità nel VirtualizingStackPanel</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;Come sapete, il &lt;font color="#800000" face="Courier New"&gt;VirtualizingStackPanel&lt;/font&gt; è uno speciale contenitore che alcuni controlli WPF utilizzano, per default, per presentare liste di dati (es. ListBox, ListView, DataGrid).&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Come infatti il nome lascia intendere, questo contenitore è in grado di virtualizzare la collection associata al controllo, di modo che la combinazione tra scorrimento e caricamento in memoria sia il più possibile "responsive" e ottimizzata per collection molto grandi.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;In WPF 4.5 il VirtualizingStackPanel subisce due ulteriori miglioramenti:&lt;/font&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;nell'architettura: by design il controllo è ora più performante di prima&lt;/font&gt; &lt;/li&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;nella gestione: viene introdotta la proprietà &lt;font color="#ff0000" face="Courier New"&gt;ScrollUnit&lt;/font&gt;, che accetta due valori: &lt;font color="#0000ff" face="Courier New"&gt;Item&lt;/font&gt; e &lt;font color="#0000ff" face="Courier New"&gt;Pixel&lt;/font&gt;. Item fa si che lo scrolling visualizzi solo gli elementi completamente virtualizzati, quindi fa sì che l'intero elemento sia visibile. Pixel, invece, scrolla normalmente mostrando un po' alla volta l'elemento in via di virtualizzazione&lt;/font&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Ho fatto un po' di test e l'uso di ScrollUnit lo ritengo abbastanza estremo. Nel senso che le performance del VirtualizingStackPanel sono ottime anche con 500000 istanze di oggetti. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Ho questo codice XAML:&lt;/font&gt;&lt;/p&gt;
&lt;font face="Verdana"&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR: #a31515"&gt;    &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="COLOR: red"&gt; DataContext&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="{&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="COLOR: blue"&gt;}&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;            &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;RowDefinition&lt;/span&gt;&lt;span style="COLOR: red"&gt; Height&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"*"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;            &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;RowDefinition&lt;/span&gt;&lt;span style="COLOR: red"&gt; Height&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"40"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;ListBox&lt;/span&gt; 
                &lt;span style="COLOR: red"&gt; VirtualizingPanel.ScrollUnit&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"Item"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Grid.Row&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"0"&lt;/span&gt;
                &lt;span style="COLOR: red"&gt; ScrollViewer.CanContentScroll&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"True"&lt;/span&gt;
                &lt;span style="COLOR: red"&gt; ItemsSource&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="{&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="COLOR: blue"&gt;}&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"VirtualizingBox"&lt;/span&gt;&lt;span style="COLOR: red"&gt; ScrollViewer.VerticalScrollBarVisibility&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"Auto"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;            &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;                &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;                    &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Border&lt;/span&gt;&lt;span style="COLOR: red"&gt; BorderBrush&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"Black"&lt;/span&gt;&lt;span style="COLOR: red"&gt; CornerRadius&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"5"&lt;/span&gt;&lt;span style="COLOR: red"&gt; BorderThickness&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"3"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Margin&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"40"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;                        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="COLOR: red"&gt; Background&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"LightBlue"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;                            &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;TextBlock&lt;/span&gt; &lt;span style="COLOR: red"&gt; Text&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="{&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="COLOR: red"&gt; FirstName&lt;/span&gt;&lt;span style="COLOR: blue"&gt;}&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Height&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"40"&lt;/span&gt;&lt;span style="COLOR: red"&gt; FontSize&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"30"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Width&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"250"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;                            &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;TextBlock&lt;/span&gt; &lt;span style="COLOR: red"&gt; Text&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="{&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="COLOR: red"&gt; LastName&lt;/span&gt;&lt;span style="COLOR: blue"&gt;}&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Height&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"40"&lt;/span&gt;&lt;span style="COLOR: red"&gt; FontSize&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"30"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Width&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"250"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;                        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;                    &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Border&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;                &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;            &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;ListBox&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Button&lt;/span&gt;&lt;span style="COLOR: red"&gt; Content&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"Load"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"LoadButton"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Click&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"LoadButton_Click"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Grid.Row&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"1"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;    &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/font&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Ho una ListBox che riceverà dei dati a runtime, per la quale ho esplicitato la virtualizzazione (è by default, ma non guasta...) e la visualizzazione di scroll bar. Ho anche impostato la attached property ScrollUnit del panel virtualizzante (che parolona &lt;img alt="" src="/aspx/providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" /&gt;). I due TextBlock sono collegati in binding a una ipotetica classe Contact o altro nome. Ho, inoltre, ipoteticamente creato una classe Contacts che è di tipo ObservableCollection(Of Contact). Se consideriamo ora il seguente codice:&lt;/font&gt;&lt;/p&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;    &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; c &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; Contact
    &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; cs &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; Contacts&lt;/font&gt;&lt;/pre&gt;
&lt;font face="Verdana"&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;    &lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt; LoadButton_Click(sender &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Object&lt;/span&gt;, e &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;RoutedEventArgs&lt;/span&gt;)
        Dispatcher.InvokeAsync(&lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;()
                                   &lt;span style="COLOR: blue"&gt;For&lt;/span&gt; i = 1 &lt;span style="COLOR: blue"&gt;To&lt;/span&gt; 100000
                                       c = &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; Contact
                                       c.Age = 34
                                       c.FirstName = &lt;span style="COLOR: #a31515"&gt;"Nome "&lt;/span&gt; + i.ToString
                                       c.LastName = &lt;span style="COLOR: #a31515"&gt;"Cognome "&lt;/span&gt; + i.ToString
                                       cs.Add(c)
                                   &lt;span style="COLOR: blue"&gt;Next&lt;/span&gt;
 
                                   &lt;span style="COLOR: blue"&gt;For&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Each&lt;/span&gt; item &lt;span style="COLOR: blue"&gt;In&lt;/span&gt; cs
                                       &lt;span style="COLOR: blue"&gt;Me&lt;/span&gt;.VirtualizingBox.Items.Add(item)
                                   &lt;span style="COLOR: blue"&gt;Next&lt;/span&gt;
                               &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;)
 
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/font&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;sto generando 100000 istanze della classe Contact e potrò verificare da solo l'opera di virtualizzazione compiuta dal VirtualizingStackPanel a runtime.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Quello che però è interessante notare è anche un nuovo metodo della classe &lt;font face="Courier New"&gt;Dispatcher&lt;/font&gt;, chiamato &lt;font face="Courier New"&gt;InvokeAsync&lt;/font&gt;, che consente di eseguire in modo asincrono un attività di tipo Action, rappresentata in questo caso da una statement lambda la quale si occupa di generare le istanze della classe.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Questa modalità asincrona consente un'ulteriore ottimizzazione del caricamento, non ci sono problemi di cross-thread perchè l'attività viene eseguita nello stesso thread ed è, inoltre, una delle altre novità di WPF 4.5.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38061.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/10ryjw7aBJ4" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/02/21/WPF-4-5-novita-nel-VirtualizingStackPanel.aspx</feedburner:origLink></item><item><title>WPF 4.5: Nuove API per le Binding Expressions</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/ULtE9GxwpiU/WPF-4-5-Nuove-API-per-le-Binding-Expressions.aspx</link><pubDate>Tue, 21 Feb 2012 16:19:39 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/02/21/WPF-4-5-Nuove-API-per-le-Binding-Expressions.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38060.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38060.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/02/21/WPF-4-5-Nuove-API-per-le-Binding-Expressions.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38060.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">WPF 4.5: Nuove API per le Binding Expressions</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;Già nelle precedenti versioni di WPF esisteva una classe chiamata &lt;font face="Courier New"&gt;BindingOperations&lt;/font&gt;, che consente l'interazione con le espressioni di binding poste in essere attraverso istanze di &lt;font face="Courier New"&gt;System.Windows.Data.Binding&lt;/font&gt; e &lt;font face="Courier New"&gt;System.Windows.Data.MultiBinding&lt;/font&gt;.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;In WPF 4.5 questa classe viene arricchita con alcune API che permettono di conoscere ulteriormente, a runtime, le espressioni di binding. In particolare è possibile recuperare:&lt;/font&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;l'oggetto destinatario del binding&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;la proprietà del citato oggetto, destinataria del binding&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;il tipo che costituisce la sorgente dati&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;la proprietà della sorgente dati che è collegata in binding&lt;/font&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Ad esempio consideriamo il seguente codice, in cui una TextBox è collegata in binding a un'istanza di una ipotetica classe Person (o Contact o come volete &lt;img alt="" src="/aspx/providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" /&gt;) che esponga una proprietà chiamata &lt;font face="Courier New"&gt;FirstName&lt;/font&gt;:&lt;/font&gt;&lt;/p&gt;
&lt;font face="Verdana"&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="COLOR: red"&gt; DataContext&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="{&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="COLOR: blue"&gt;}&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;            &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;TextBlock&lt;/span&gt;&lt;span style="COLOR: red"&gt; Text&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="{&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="COLOR: red"&gt; FirstName&lt;/span&gt;&lt;span style="COLOR: blue"&gt;}&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"&lt;/span&gt;&lt;span style="COLOR: red"&gt; FontSize&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"18"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"NameBox"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;            &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Button&lt;/span&gt;&lt;span style="COLOR: red"&gt; Name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"GetBindingButton"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Width&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"100"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Height&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"30"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Content&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"Go!"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/font&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;In questo esempio la binding expression è costituita dal contenuto della coppia di parentesi graffe all'interno della proprietà Text. Scrivendo codice come il seguente:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana" /&gt;&lt;/p&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;    &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; expression = &lt;span style="COLOR: #2b91af"&gt;BindingOperations&lt;/span&gt;.GetBindingExpression(NameBox, &lt;span style="COLOR: #2b91af"&gt;TextBlock&lt;/span&gt;.TextProperty)
 
    &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; target &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;DependencyObject&lt;/span&gt; = Expression.Target
    &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; targetProperty &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;DependencyProperty&lt;/span&gt; = Expression.TargetProperty
    &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; source &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Object&lt;/span&gt; = Expression.ResolvedSource
    &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; sourceName &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt; = Expression.ResolvedSourcePropertyName
 
    &lt;span style="COLOR: green"&gt;'Mostra: TextBlock&lt;/span&gt;
        MessageBox.Show(target.DependencyObjectType.Name)
    &lt;span style="COLOR: green"&gt;'Mostra: Text&lt;/span&gt;
        MessageBox.Show(targetProperty.Name)
    &lt;span style="COLOR: green"&gt;'Mostra: Person (o Contact o il nome del tipo)&lt;/span&gt;
        MessageBox.Show(source.GetType.Name)
    &lt;span style="COLOR: green"&gt;'Mostra: FirstName&lt;/span&gt;
        MessageBox.Show(sourceName)&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;è possibile ottenere determinate informazioni sul binding, come da commenti nel codice. Fondamentale è l'invocazione al metodo GetBindingExpression della classe BindingOperations, i cui argomenti sono il nome del controllo su cui insiste il binding e il nome della dependency property di cui vogliamo ottenere informazioni. E' abbastanza ovvio che, nel caso degli oggetti target, si tratti rispettivamente di DependencyObject e DependencyProperty. Questo è chiaramente solo un esempio, sfruttando le varie proprietà di istanza esposte dai tipi ottenuti è possibile ottenere anche il risultato di espressioni più complesse.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38060.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/ULtE9GxwpiU" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/02/21/WPF-4-5-Nuove-API-per-le-Binding-Expressions.aspx</feedburner:origLink></item><item><title>WPF 4.5: INotifyDataErrorInfo</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/jXY7Agu8Rx0/WPF-4-5-INotifyDataErrorInfo.aspx</link><pubDate>Mon, 20 Feb 2012 15:23:01 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/02/20/WPF-4-5-INotifyDataErrorInfo.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38059.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38059.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/02/20/WPF-4-5-INotifyDataErrorInfo.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38059.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">WPF 4.5: INotifyDataErrorInfo</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;WPF 4.5 introduce una significativa novità nella validazione dei dati, costituita dall'interfaccia &lt;font face="Courier New"&gt;INotifyDataErrorInfo&lt;/font&gt;. Questa proviene da Silverlight e la sua peculiarità è quella di poter validare i dati anche in modalità asincrona (es. nell'ambito di callback).&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Tale interfaccia ha tre membri fondamentali da implementare:&lt;/font&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;la proprietà HasErrors, di tipo booleano, che restituisce vero o falso a seconda che per la proprietà specificata esistano o meno errori di validazione&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;il metodo GetErrors che restituisce una IEnumerable di errori di validazione che colpiscono la proprietà specificata&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;l'evento ErrorsChanged, che va scatenato quando la collezione di errori viene modificata&lt;/font&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Il seguente esempio (tratto da MSDN per Silverlight) mostra come implementare l'interfaccia e come aggiungere o rimuovere, da una collection di tipo Dictionary, voci costituenti errori di validazione attraverso due metodi chiamati AddError e RemoveError:&lt;/font&gt;&lt;/p&gt;
&lt;font face="Verdana"&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR: blue"&gt;Imports&lt;/span&gt; System.ComponentModel
 
&lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Product&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Implements&lt;/span&gt; INotifyDataErrorInfo
 
    &lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; idValue &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Integer&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt; Id &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Integer&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Get&lt;/span&gt;
            &lt;span style="COLOR: blue"&gt;Return&lt;/span&gt; idValue
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Get&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Set&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;ByVal&lt;/span&gt; value &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Integer&lt;/span&gt;)
            &lt;span style="COLOR: blue"&gt;If&lt;/span&gt; IsIdValid(value) &lt;span style="COLOR: blue"&gt;AndAlso&lt;/span&gt;
                idValue &amp;lt;&amp;gt; value &lt;span style="COLOR: blue"&gt;Then&lt;/span&gt; idValue = value
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Set&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; nameValue &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt; Name &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Get&lt;/span&gt;
            &lt;span style="COLOR: blue"&gt;Return&lt;/span&gt; nameValue
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Get&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Set&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;ByVal&lt;/span&gt; value &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;)
            &lt;span style="COLOR: blue"&gt;If&lt;/span&gt; IsNameValid(value) &lt;span style="COLOR: blue"&gt;AndAlso&lt;/span&gt;
                nameValue &amp;lt;&amp;gt; value &lt;span style="COLOR: blue"&gt;Then&lt;/span&gt; nameValue = value
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Set&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt;
 
    &lt;span style="COLOR: green"&gt;' Validates the Id property, updating the errors collection as needed.&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Function&lt;/span&gt; IsIdValid(&lt;span style="COLOR: blue"&gt;ByVal&lt;/span&gt; value &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Integer&lt;/span&gt;) &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Boolean&lt;/span&gt;
 
        &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; isValid = &lt;span style="COLOR: blue"&gt;True&lt;/span&gt;
 
        &lt;span style="COLOR: blue"&gt;If&lt;/span&gt; value &amp;lt; 5 &lt;span style="COLOR: blue"&gt;Then&lt;/span&gt;
            AddError(&lt;span style="COLOR: #a31515"&gt;"Id"&lt;/span&gt;, ID_ERROR, &lt;span style="COLOR: blue"&gt;False&lt;/span&gt;)
            isValid = &lt;span style="COLOR: blue"&gt;False&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Else&lt;/span&gt;
            RemoveError(&lt;span style="COLOR: #a31515"&gt;"Id"&lt;/span&gt;, ID_ERROR)
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;If&lt;/span&gt;
 
        &lt;span style="COLOR: blue"&gt;If&lt;/span&gt; value &amp;gt; 10 &lt;span style="COLOR: blue"&gt;Then&lt;/span&gt;
            AddError(&lt;span style="COLOR: #a31515"&gt;"Id"&lt;/span&gt;, ID_WARNING, &lt;span style="COLOR: blue"&gt;True&lt;/span&gt;)
        &lt;span style="COLOR: blue"&gt;Else&lt;/span&gt;
            RemoveError(&lt;span style="COLOR: #a31515"&gt;"Id"&lt;/span&gt;, ID_WARNING)
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;If&lt;/span&gt;
 
        &lt;span style="COLOR: blue"&gt;Return&lt;/span&gt; isValid
 
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Function&lt;/span&gt;
 
    &lt;span style="COLOR: green"&gt;' Validates the Name property, updating the errors collection as needed.&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Function&lt;/span&gt; IsNameValid(&lt;span style="COLOR: blue"&gt;ByVal&lt;/span&gt; value &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;) &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Boolean&lt;/span&gt;
 
        &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; isValid = &lt;span style="COLOR: blue"&gt;True&lt;/span&gt;
 
        &lt;span style="COLOR: blue"&gt;If&lt;/span&gt; value.Contains(&lt;span style="COLOR: #a31515"&gt;" "&lt;/span&gt;) &lt;span style="COLOR: blue"&gt;Then&lt;/span&gt;
            AddError(&lt;span style="COLOR: #a31515"&gt;"Name"&lt;/span&gt;, NAME_ERROR, &lt;span style="COLOR: blue"&gt;False&lt;/span&gt;)
            isValid = &lt;span style="COLOR: blue"&gt;False&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Else&lt;/span&gt;
            RemoveError(&lt;span style="COLOR: #a31515"&gt;"Name"&lt;/span&gt;, NAME_ERROR)
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;If&lt;/span&gt;
 
        &lt;span style="COLOR: blue"&gt;If&lt;/span&gt; (value.Length &amp;gt; 5) &lt;span style="COLOR: blue"&gt;Then&lt;/span&gt;
            AddError(&lt;span style="COLOR: #a31515"&gt;"Name"&lt;/span&gt;, NAME_WARNING, &lt;span style="COLOR: blue"&gt;True&lt;/span&gt;)
        &lt;span style="COLOR: blue"&gt;Else&lt;/span&gt;
            RemoveError(&lt;span style="COLOR: #a31515"&gt;"Name"&lt;/span&gt;, NAME_WARNING)
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;If&lt;/span&gt;
 
        &lt;span style="COLOR: blue"&gt;Return&lt;/span&gt; isValid
 
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Function&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; errors &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Dictionary&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;Of&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;, &lt;span style="COLOR: #2b91af"&gt;List&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;Of&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;))
    &lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;ReadOnly&lt;/span&gt; ID_ERROR &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt; = &lt;span style="COLOR: #a31515"&gt;"Value cannot be less than 5."&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;ReadOnly&lt;/span&gt; ID_WARNING &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt; = &lt;span style="COLOR: #a31515"&gt;"Value should not be less than 10."&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;ReadOnly&lt;/span&gt; NAME_ERROR &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt; = &lt;span style="COLOR: #a31515"&gt;"Value must not contain any spaces."&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;ReadOnly&lt;/span&gt; NAME_WARNING &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt; = &lt;span style="COLOR: #a31515"&gt;"Value should be 5 characters or less."&lt;/span&gt;
 
    &lt;span style="COLOR: green"&gt;' Adds the specified error to the errors collection if it is not &lt;/span&gt;
    &lt;span style="COLOR: green"&gt;' already present, inserting it in the first position if isWarning is &lt;/span&gt;
    &lt;span style="COLOR: green"&gt;' false. Raises the ErrorsChanged event if the collection changes. &lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt; AddError(&lt;span style="COLOR: blue"&gt;ByVal&lt;/span&gt; propertyName &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;ByVal&lt;/span&gt; [error] &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;,
                        &lt;span style="COLOR: blue"&gt;ByVal&lt;/span&gt; isWarning &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Boolean&lt;/span&gt;)
 
        &lt;span style="COLOR: blue"&gt;If&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Not&lt;/span&gt; errors.ContainsKey(propertyName) &lt;span style="COLOR: blue"&gt;Then&lt;/span&gt; _
            errors(propertyName) = &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;List&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;Of&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;)()
 
        &lt;span style="COLOR: blue"&gt;If&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Not&lt;/span&gt; errors(propertyName).Contains([error]) &lt;span style="COLOR: blue"&gt;Then&lt;/span&gt;
            &lt;span style="COLOR: blue"&gt;If&lt;/span&gt; isWarning &lt;span style="COLOR: blue"&gt;Then&lt;/span&gt;
                errors(propertyName).Add([error])
            &lt;span style="COLOR: blue"&gt;Else&lt;/span&gt;
                errors(propertyName).Insert(0, [error])
            &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;If&lt;/span&gt;
            RaiseErrorsChanged(propertyName)
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;If&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;
 
    &lt;span style="COLOR: green"&gt;' Removes the specified error from the errors collection if it is&lt;/span&gt;
    &lt;span style="COLOR: green"&gt;' present. Raises the ErrorsChanged event if the collection changes.&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt; RemoveError(&lt;span style="COLOR: blue"&gt;ByVal&lt;/span&gt; propertyName &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;ByVal&lt;/span&gt; [error] &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;)
 
        &lt;span style="COLOR: blue"&gt;If&lt;/span&gt; errors.ContainsKey(propertyName) &lt;span style="COLOR: blue"&gt;AndAlso&lt;/span&gt;
            errors(propertyName).Contains([error]) &lt;span style="COLOR: blue"&gt;Then&lt;/span&gt;
 
            errors(propertyName).Remove([error])
            &lt;span style="COLOR: blue"&gt;If&lt;/span&gt; errors(propertyName).Count = 0 &lt;span style="COLOR: blue"&gt;Then&lt;/span&gt; errors.Remove(propertyName)
            RaiseErrorsChanged(propertyName)
 
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;If&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt; RaiseErrorsChanged(&lt;span style="COLOR: blue"&gt;ByVal&lt;/span&gt; propertyName &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;)
        &lt;span style="COLOR: blue"&gt;RaiseEvent&lt;/span&gt; ErrorsChanged(&lt;span style="COLOR: blue"&gt;Me&lt;/span&gt;,
            &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; DataErrorsChangedEventArgs(propertyName))
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Event&lt;/span&gt; ErrorsChanged &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; EventHandler(&lt;span style="COLOR: blue"&gt;Of&lt;/span&gt; DataErrorsChangedEventArgs) _
        &lt;span style="COLOR: blue"&gt;Implements&lt;/span&gt; INotifyDataErrorInfo.ErrorsChanged
 
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Function&lt;/span&gt; GetErrors(&lt;span style="COLOR: blue"&gt;ByVal&lt;/span&gt; propertyName &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;) _
        &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; System.Collections.&lt;span style="COLOR: #2b91af"&gt;IEnumerable&lt;/span&gt; _
        &lt;span style="COLOR: blue"&gt;Implements&lt;/span&gt; INotifyDataErrorInfo.GetErrors
        &lt;span style="COLOR: blue"&gt;Return&lt;/span&gt; errors(propertyName)
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Function&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;ReadOnly&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt; HasErrors &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Boolean&lt;/span&gt; _
        &lt;span style="COLOR: blue"&gt;Implements&lt;/span&gt; INotifyDataErrorInfo.HasErrors
        &lt;span style="COLOR: blue"&gt;Get&lt;/span&gt;
            &lt;span style="COLOR: blue"&gt;Return&lt;/span&gt; errors.Any
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Get&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt;
 
&lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Class&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/font&gt;
&lt;p&gt;&lt;font face="Verdana" /&gt; &lt;font face="Verdana"&gt;Lato XAML l'accortezza che bisogna avere è quella di impostare a True l'espressione &lt;font face="Courier New"&gt;NotifyOnValidationError&lt;/font&gt;:&lt;/font&gt;&lt;/p&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR: #a31515"&gt;    &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;TextBox&lt;/span&gt;&lt;span style="COLOR: red"&gt; Text&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="{&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="COLOR: red"&gt; Path&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;Id&lt;/span&gt;&lt;span style="COLOR: blue"&gt;,&lt;/span&gt;&lt;span style="COLOR: red"&gt; Mode&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;TwoWay&lt;/span&gt;&lt;span style="COLOR: blue"&gt;,&lt;/span&gt;&lt;span style="COLOR: red"&gt; NotifyOnValidationError&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;True&lt;/span&gt;&lt;span style="COLOR: blue"&gt;}&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Margin&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"5"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;TextBox&lt;/span&gt;&lt;span style="COLOR: red"&gt; Text&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="{&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="COLOR: red"&gt; Path&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;Name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;,&lt;/span&gt;&lt;span style="COLOR: red"&gt;Mode&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;TwoWay&lt;/span&gt;&lt;span style="COLOR: blue"&gt;,&lt;/span&gt;&lt;span style="COLOR: red"&gt;NotifyOnValidationError&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;True&lt;/span&gt;&lt;span style="COLOR: blue"&gt;}&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Margin&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"5"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;    &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Chiaramente WPF utilizza un template di default per la visualizzazione degli errori, per cui un errore verrebbe evidenziato in questo modo:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;&lt;img width="301" height="303" alt="" src="/images/community_visual-basic_it/Alessandro/630/NotifyWpf45.jpg" /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Come però sapete è possibile ridefinire l'&lt;font face="Courier New"&gt;ErrorTemplate&lt;/font&gt; delle TextBox e presentare gli errori in modo anche diverso.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;font color="#339966" face="Verdana"&gt;Alessandro&lt;/font&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38059.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/jXY7Agu8Rx0" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/02/20/WPF-4-5-INotifyDataErrorInfo.aspx</feedburner:origLink></item><item><title>WPF 4.5: integrazione grafica Win32 migliorata</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/uXvIcjEW5FA/WPF-4-5-integrazione-grafica-Win32-migliorata.aspx</link><pubDate>Mon, 20 Feb 2012 15:11:38 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/02/20/WPF-4-5-integrazione-grafica-Win32-migliorata.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38058.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38058.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/02/20/WPF-4-5-integrazione-grafica-Win32-migliorata.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38058.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">WPF 4.5: integrazione grafica Win32 migliorata</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;Sebbene anche nelle versioni precedenti di WPF fosse possibile integrare elementi grafici Win32 all'interno di elementi WPF, in passato esisteva il problema del cosiddetto &lt;a href="http://msdn.microsoft.com/en-us/library/aa970688(v=vs.85).aspx"&gt;air space&lt;/a&gt;. Sostanzialmente, secondo la logica dell'air space, ogni elemento ha un suo spazio che non può prevaricare quello degli altri.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Tradotto in altri termini e semplificando al massimo la questione, elementi Win32 che venivano integrati con WPF fino alla v. 4.0 non potevano subire alcune azioni tipiche di WPF stessa, ad esempio gli oggetti Win32 integrati non potevano essere sottoposti all'utilizzo di oggetti Transform o di oggetti Brush.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Per capire come cambiano le cose in WPF 4.5, possiamo ricorrere al controllo WebBrowser che apparentemente è nativo di WPF ma in realtà è un wrapper della controparte Win32. Quindi possiamo scrivere qualcosa di questo tipo:&lt;/font&gt;&lt;/p&gt;
&lt;font face="Verdana"&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR: #a31515"&gt;    &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;UniformGrid&lt;/span&gt;&lt;span style="COLOR: red"&gt; Columns&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"2"&lt;/span&gt;&lt;span style="COLOR: red"&gt; x&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: red"&gt;Name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"grid"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;WebBrowser&lt;/span&gt;&lt;span style="COLOR: red"&gt; x&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: red"&gt;Name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"_webBrowser"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Source&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"http://www.visual-basic.it"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Margin&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"5"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Opacity&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"0.6"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;            &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;WebBrowser.RenderTransform&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;                &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;ScaleTransform&lt;/span&gt;&lt;span style="COLOR: red"&gt; ScaleX&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"0.5"&lt;/span&gt;&lt;span style="COLOR: red"&gt; ScaleY&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"0.5"&lt;/span&gt;&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;            &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;WebBrowser.RenderTransform&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;WebBrowser&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Rectangle&lt;/span&gt;&lt;span style="COLOR: red"&gt; Margin&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"5"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;            &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Rectangle.Fill&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;                &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;VisualBrush&lt;/span&gt;&lt;span style="COLOR: red"&gt; Visual&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="{&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="COLOR: red"&gt; ElementName&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;_&lt;span style="COLOR: blue"&gt;webBrowser&lt;/span&gt;&lt;span style="COLOR: blue"&gt;}&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"&lt;/span&gt;&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;            &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Rectangle.Fill&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Rectangle&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;    &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;UniformGrid&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/font&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Il rendering viene poi controllato dalle seguenti due nuove proprietà dell'oggetto HWndHost:&lt;/font&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;IsRedirected che, se True, stabilisce che l'HwndHost può condividere l'air space tra WPF e Win32&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;CompositionMode, che permette di stabilire la modalità con cui l'air space viene condiviso (None, OutputOnly dove la condivisione è ammessa ma l'utente non può agire sul contenuto hostato, Full dove la condivisione è ammessa e l'utente ha pieno accesso al contenuto hostato).&lt;/font&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Così facendo, laddove aveste necessità di integrare dei contenuti grafici di tipo Win32, sappiate che ora potete sfruttarli ancora meglio anche dal punto di vista delle trasformazioni.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38058.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/uXvIcjEW5FA" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/02/20/WPF-4-5-integrazione-grafica-Win32-migliorata.aspx</feedburner:origLink></item><item><title>WPF 4.5: data-binding verso proprietà statiche</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/Vwt6biZnGy8/WPF-4-5-data-binding-verso-proprieta-statiche.aspx</link><pubDate>Mon, 20 Feb 2012 14:58:28 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/02/20/WPF-4-5-data-binding-verso-proprieta-statiche.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38057.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38057.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/02/20/WPF-4-5-data-binding-verso-proprieta-statiche.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38057.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">WPF 4.5: data-binding verso proprietà statiche</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;In WPF 4.5 viene aggiunto il supporto per il data-binding anche nei confronti di proprietà statiche (&lt;em&gt;shared &lt;/em&gt;in VB) delle nostre classi. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Questa peculiarità è stata richiesta a gran voce da molti e Microsoft ha deciso di accoglierla nella nuova versione di WPF. L'utilizzo è abbastanza semplice e si può scegliere tra due approcci che ora andiamo ad esaminare. Consideriamo la seguente classe, che espone due proprietà statiche di pura fantasia:&lt;/font&gt;&lt;/p&gt;
&lt;font face="Verdana"&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR: blue"&gt;Imports&lt;/span&gt; System.ComponentModel
 
&lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;StaticModel&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Shared&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Event&lt;/span&gt; ValoreCondivisoChanged &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;EventHandler&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Shared&lt;/span&gt; _valoreCondiviso &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Shared&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt; ValoreCondiviso &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Get&lt;/span&gt;
            &lt;span style="COLOR: blue"&gt;Return&lt;/span&gt; _valoreCondiviso
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Get&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Set&lt;/span&gt;(value &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;)
            &lt;span style="COLOR: blue"&gt;If&lt;/span&gt; value &amp;lt;&amp;gt; _valoreCondiviso &lt;span style="COLOR: blue"&gt;Then&lt;/span&gt;
                _valoreCondiviso = value
                &lt;span style="COLOR: blue"&gt;RaiseEvent&lt;/span&gt; ValoreCondivisoChanged(&lt;span style="COLOR: blue"&gt;Nothing&lt;/span&gt;, &lt;span style="COLOR: #2b91af"&gt;EventArgs&lt;/span&gt;.Empty)
            &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;If&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Set&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Shared&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Event&lt;/span&gt; StaticPropertyChanged &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;EventHandler&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;Of&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;PropertyChangedEventArgs&lt;/span&gt;)
 
    &lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Shared&lt;/span&gt; _velocità &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Double&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Shared&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt; Velocità &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Double&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Get&lt;/span&gt;
            &lt;span style="COLOR: blue"&gt;Return&lt;/span&gt; _velocità
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Get&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Set&lt;/span&gt;(value &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Double&lt;/span&gt;)
            _velocità = value
            NotifyStaticPropertyChanged(&lt;span style="COLOR: #a31515"&gt;"Velocità"&lt;/span&gt;)
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Set&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Shared&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt; NotifyStaticPropertyChanged(propertyName &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;)
        &lt;span style="COLOR: blue"&gt;RaiseEvent&lt;/span&gt; StaticPropertyChanged(&lt;span style="COLOR: blue"&gt;Nothing&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;PropertyChangedEventArgs&lt;/span&gt;(propertyName))
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;
&lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Class&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/font&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Le implementazioni delle due proprietà sono accomunate dal fatto che entrambe devono scatenare un evento che farà sapere all'interfaccia grafica che i dati sono cambiati. Ciò premesso, nella prima proprietà si dichiara un evento non generico (in senso .NET &lt;img alt="" src="/aspx/providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" /&gt;) e questo evento viene scatenato al variare dei dati. Poichè è un tipo EventHandler, questo approccio non è considerato 'astratto' o riutilizzabile, ma specifico per la singola proprietà.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Nel secondo caso c'è invece un evento generico chiamato StaticPropertyChanged, la cui implementazione richiama il comportamento della ben nota INotifyPropertyChanged e permetterà di notificare alla UI le modifiche attraverso un approccio generico e passando informazioni addizionali. Vedremo poi lato XAML la differenza sostanziale tra i due.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Il binding lato XAML funziona in modo identico a come già conosciamo, con una piccola differenza sintattica. Nel caso specifico dichiaro un namespace XML che mi permetta di accedere alle proprietà:&lt;/font&gt;&lt;/p&gt;
&lt;font face="Verdana"&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR: red"&gt;xmlns&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: red"&gt;local&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"clr-namespace:WpfApplication1"&lt;/span&gt;&lt;/font&gt;
&lt;/pre&gt;
&lt;/font&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Supponiamo poi di avere alcuni controlli utente che debbano essere collegati in binding con le proprietà di cui sopra:&lt;/font&gt;&lt;/p&gt;
&lt;font face="Verdana"&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR: #a31515"&gt;    &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;TextBox&lt;/span&gt;&lt;span style="COLOR: red"&gt; Text&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="{&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="COLOR: red"&gt; Path&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=(&lt;/span&gt;&lt;span style="COLOR: blue"&gt;local&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: blue"&gt;StaticModel&lt;/span&gt;&lt;span style="COLOR: blue"&gt;.&lt;/span&gt;&lt;span style="COLOR: blue"&gt;ValoreCondiviso&lt;/span&gt;&lt;span style="COLOR: blue"&gt;),&lt;/span&gt;&lt;span style="COLOR: red"&gt; Mode&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;TwoWay&lt;/span&gt;&lt;span style="COLOR: blue"&gt;,&lt;/span&gt;&lt;span style="COLOR: red"&gt; UpdateSourceTrigger&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;PropertyChanged&lt;/span&gt;&lt;span style="COLOR: blue"&gt;}&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Width&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"100"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Height&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"30"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;TextBlock&lt;/span&gt;&lt;span style="COLOR: red"&gt; Text&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="{&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="COLOR: red"&gt; Path&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=(&lt;/span&gt;&lt;span style="COLOR: blue"&gt;local&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: blue"&gt;StaticModel&lt;/span&gt;&lt;span style="COLOR: blue"&gt;.&lt;/span&gt;&lt;span style="COLOR: blue"&gt;Velocità&lt;/span&gt;&lt;span style="COLOR: blue"&gt;)}&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Width&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"100"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Height&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"30"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Button&lt;/span&gt;&lt;span style="COLOR: red"&gt; Content&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"Button"&lt;/span&gt;&lt;span style="COLOR: red"&gt; HorizontalAlignment&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"Left"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Height&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"29"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Margin&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"43,192,0,0"&lt;/span&gt;&lt;span style="COLOR: red"&gt; VerticalAlignment&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"Top"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Width&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"200"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Click&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"Button_Click"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;    &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/font&gt;
&lt;p&gt;&lt;font color="#800000" face="Verdana"&gt;&lt;strong&gt;NOTA BENE:&lt;/strong&gt; Nella prima develope preview di VS 11, il codice di cui sopra fa comparire un errore nel designer, ma dovete ignorarlo. E' un problema già noto e si verifica anche se la sintassi è corretta.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Possiamo quindi notare che:&lt;/font&gt;&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;la sintassi vuole che dopo &lt;font color="#ff0000" face="Courier New"&gt;Path&lt;/font&gt;, ci sia una coppia di parentesi tonde all'interno della quale la proprietà statica è raggiungibile nella forma &lt;/font&gt;&lt;font face="Courier New"&gt;namespace:NomeClasse.NomeProprietà&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;nel caso dell'approccio con evento non generico, si esplicità l'&lt;font face="Courier New"&gt;UpdateSourceTrigger&lt;/font&gt; come &lt;font face="Courier New"&gt;PropertyChanged&lt;/font&gt; (atteso che l'evento non generico non si comporta come l'altro che richiama il meccanismo delle notifiche)&lt;/font&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Vi basta modificare a runtime i valori delle due proprietà e rendervi conto come in effetti il data-binding funzioni nel modo atteso.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38057.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/Vwt6biZnGy8" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/02/20/WPF-4-5-data-binding-verso-proprieta-statiche.aspx</feedburner:origLink></item><item><title>Archivio Sportelli Bancari - Elenco Abi Cab Aggiornato a Fine Gennaio 2012</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/oLoOUcUtRBI/Archivio-Sportelli-Bancari-Elenco-Abi-Cab-Aggiornato-a-Fine-Gennaio.aspx</link><pubDate>Mon, 20 Feb 2012 07:55:58 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/LucianoB/archive/2012/02/20/Archivio-Sportelli-Bancari-Elenco-Abi-Cab-Aggiornato-a-Fine-Gennaio.aspx</guid><wfw:comment>http://community.visual-basic.it/LucianoB/comments/38056.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/LucianoB/comments/commentRss/38056.aspx</wfw:commentRss><comments>http://community.visual-basic.it/LucianoB/archive/2012/02/20/Archivio-Sportelli-Bancari-Elenco-Abi-Cab-Aggiornato-a-Fine-Gennaio.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/LucianoB/services/trackbacks/38056.aspx</trackback:ping><source url="http://community.visual-basic.it/LucianoB/rss.aspx">Archivio Sportelli Bancari - Elenco Abi Cab Aggiornato a Fine Gennaio 2012</source><description>&lt;p&gt;L'archivio sportelli bancari elenco Abi Cab aggiornato a fine gennaio 2012 disponibile per lo scaricamento &lt;a href="http://www.4shared.com/zip/_svLbOtV/abicab2012_01.html"&gt;a questo indirizzo&lt;/a&gt;: &lt;br /&gt;Alcune informazioni sui files: &lt;br /&gt;- campi separati da tabulazione hex: 09 &lt;br /&gt;- righe separate dal terminatore di riga windows hex: 0d0a &lt;br /&gt;- intestazione colonne sulla prima riga &lt;br /&gt;Il file TabAbi contiene i dati relativi alle banche. &lt;br /&gt;Il file TabAbiCab contiene le informazioni relative agli sportelli &lt;br /&gt;Nel file TabAbi e TabAbiCab è presente il campo "Aggiornamento" che evidenzia la data di riferimento di validità dei dati. &lt;br /&gt;Tutte le righe di TabAbiCab che NON contengono la data più recente sono da considerarsi relative a sportelli non più attivi o assorbiti da altre banche, tali sportelli sono presenti solo come log dei dati storici, ne è sconsigliato l'utilizzo per nuove emissioni di flussi di comunicazione con le banche. &lt;br /&gt;Questo archivio è da considerarsi frutto di una rielaborazione "amatoriale" dei dati degli sportelli bancari reperibili in rete l'unico mio apporto è l'aggiunta della data di ultima importazione in modo tale da costituire un archivio comprendente anche i dati di banche e sportelli non più attivi. &lt;br /&gt;Non si rivendica nessun diritto riguardo al contenuto del file, l'utilizzatore ne può fare ciò che vuole senza contattarmi nè informarmi della cosa, preferirei inoltre non essere neanche citato come fonte in eventuali successive redistribuzioni. &lt;br /&gt;Se si vuole una garanzia circa la correttezza dei dati e/o una qualsiasi licenza il mio consiglio è di NON utilizzare il presente archivio e di rivolgersi direttamente alla propria banca chiedendo di avere in forma ufficiale il file degli sportelli bancari. &lt;br /&gt;I ringraziamenti sono comunque graditi. &lt;br /&gt;Se sentite il malsano bisogno di farmi pervenire una somma di denaro, in alternativa scegliete l'organizzazione umanitaria a voi più gradita e fate a questa il vostro pagamento. &lt;/p&gt; &lt;p align="right"&gt;&lt;a href="http://get.live.com/writer/overview"&gt;Powered with Windows Live Writer&lt;/a&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/LucianoB/aggbug/38056.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/oLoOUcUtRBI" height="1" width="1"/&gt;</description><dc:creator>Luciano Bastianello</dc:creator><feedburner:origLink>http://community.visual-basic.it/LucianoB/archive/2012/02/20/Archivio-Sportelli-Bancari-Elenco-Abi-Cab-Aggiornato-a-Fine-Gennaio.aspx</feedburner:origLink></item><item><title>Community Days 2012: com'è andata</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/z57kXAZf54w/Community-Days-2012-come-andata.aspx</link><pubDate>Sun, 19 Feb 2012 11:10:46 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/02/19/Community-Days-2012-come-andata.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38055.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38055.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/02/19/Community-Days-2012-come-andata.aspx#comment</comments><slash:comments>1</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38055.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">Community Days 2012: com'è andata</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;&lt;img alt="" src="http://www.visual-basic.it/images/communitydays2012.png" /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Come sapete, giovedì e venerdì u.s. si sono tenuti i &lt;a href="http://www.communitydays.it/events/communitydays-2012/"&gt;Community Days 2012&lt;/a&gt; a Milano, presso la nuova sede di Microsoft Italia a Peschiera Borromeo (MI).&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Si tratta dell'evento community più importante dell'anno, poichè le community italiane vengono coinvolte sia a livello di speaker e sessioni, sia a livello di sinergie nel sostenere l'evento stesso.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;&lt;a href="http://www.visual-basic.it"&gt;VB T&amp;amp;T&lt;/a&gt; ha partecipato con me e &lt;a href="http://community.visual-basic.it/renato"&gt;Renato Marzaro&lt;/a&gt; come speaker; la mia sessione su WPF 4.5 ha riempito la sala (di questo ne sono chiaramente onorato) ed è stata una delle poche volte in cui, parlando di WPF, ho trovato un pubblico molto preparato in materia. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;L'evento ha consentito di presentare argomenti e tecnologie assolutamente di primo piano, come lo sviluppo Metro per Windows 8, le nuove Web API, Kinect, il Web sotto vari di punti di vista.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Ma al di là di questo, che è chiaramente importante, c'era un'atmosfera eccezionale. Un incontro tecnico, certo, ma un ritrovarsi tra amici e una partecipazione tipica dello spirito di community. Ho partecipato a tanti eventi, sia come attendee che come speaker, ma ai Community Days 2012 ho vissuto un'esperienza veramente speciale.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;I miei più sinceri complimenti a &lt;a href="http://blogs.aspitalia.com/daniele/"&gt;Daniele Bochicchio&lt;/a&gt; e &lt;a href="http://blogs.ugidotnet.org/pape/"&gt;Andrea Saltarello&lt;/a&gt; per un'organizzazione impeccabile e degna di giornate come queste e un ringraziamento a tutti coloro che hanno contribuito alle giornate.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;E speriamo di replicare in un'altra occasione ;) Non dimenticate di visitare il sito dell'evento anche per il download dei materiali.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38055.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/z57kXAZf54w" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/02/19/Community-Days-2012-come-andata.aspx</feedburner:origLink></item><item><title>Dopo dieci anni&amp;hellip;</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/reo5ED8W0k0/Dopo-dieci-annihellip.aspx</link><pubDate>Fri, 17 Feb 2012 10:54:00 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Diego/archive/2012/02/17/Dopo-dieci-annihellip.aspx</guid><wfw:comment>http://community.visual-basic.it/Diego/comments/38054.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Diego/comments/commentRss/38054.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Diego/archive/2012/02/17/Dopo-dieci-annihellip.aspx#comment</comments><slash:comments>2</slash:comments><trackback:ping>http://community.visual-basic.it/Diego/services/trackbacks/38054.aspx</trackback:ping><source url="http://community.visual-basic.it/Diego/rss.aspx">Dopo dieci anni&amp;hellip;</source><description>&lt;p&gt;Ogni tanto capita di sentirsi soddisfatti.&lt;/p&gt;
&lt;p&gt;Oggi ho ricevuto il seguente messaggio:&lt;/p&gt;
&lt;blockquote&gt;&lt;span lang="IT"&gt;
&lt;p&gt;&lt;em&gt;Buongiorno Diego ti volevo ringraziare per il tuo fondamentale aiuto. &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Da ieri sto usando SOLO il programma in VB2010 che soprattutto grazie a te sono riuscito a finire o meglio adesso lo posso perfezionare ai miei… usi e consumi.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Ho abbandonato sinceramente con un po' di ..timore il vecchio in VB6 dopo 10 anni di ..onorato servizio ma....doveva accadere.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;ti ringrazio di nuovo e ti auguro una buona giornata.&lt;/em&gt;&lt;/p&gt;
&lt;/span&gt;
&lt;/blockquote&gt;
&lt;p&gt;Ora, che uno si decida a sviluppare in .Net non è poi quel gran evento, se accade dopo dieci anni, ma è un evento che 'il merito' di questo cambiamento sia attribuito a me in modo così 'importante' da far sentire il dovere (o l'entusiasmo) di scrivermi appositamente un messaggio di ringraziamento.&lt;/p&gt;
&lt;p&gt;E' in momenti come questo che uno si sente degno della nomina a MVP :D:D:D&lt;/p&gt;
&lt;img src="http://community.visual-basic.it/Diego/aggbug/38054.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/reo5ED8W0k0" height="1" width="1"/&gt;</description><dc:creator>Diego Cattaruzza</dc:creator><feedburner:origLink>http://community.visual-basic.it/Diego/archive/2012/02/17/Dopo-dieci-annihellip.aspx</feedburner:origLink></item><item><title>Stampare direttamente un reportViewer</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/WtFE9X8T7CQ/Stampare-direttamente-un-reportViewer.aspx</link><pubDate>Fri, 17 Feb 2012 08:58:47 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/flavio/archive/2012/02/17/Stampare-direttamente-un-reportViewer.aspx</guid><wfw:comment>http://community.visual-basic.it/flavio/comments/38053.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/flavio/comments/commentRss/38053.aspx</wfw:commentRss><comments>http://community.visual-basic.it/flavio/archive/2012/02/17/Stampare-direttamente-un-reportViewer.aspx#comment</comments><slash:comments>1</slash:comments><trackback:ping>http://community.visual-basic.it/flavio/services/trackbacks/38053.aspx</trackback:ping><source url="http://community.visual-basic.it/flavio/rss.aspx">Stampare direttamente un reportViewer</source><description>Uno dei post più caldi dell'anno viene riservato alla stampa diretta del reportviewer. Siamo tutti felici quando vediamo il nostro report a video e lo mandiamo alla stampante tramite la sua icona. Però cosa succede se ho molti report da stampare, per esempio un centinaio di fatture a fine mese? Cento click sull'icona sono fastidiosi e fanno perdere un sacco di tempo.&lt;br /&gt;
Allora procediamo con calma. Esiste una funzione che permette la stampa diretta, ma parte dal presupposto di creare un immagine grafica in memoria e stamparla. Funziona, certo ma cambia l'altezza di alcuni font con il risultato di avere le stampe imperfette.&lt;br /&gt;
La logica della mia funzione è simile, ma genero un file PDF che poi stampo. Per ampliare l'impatto emotivo della funzione immagino di avere tutti i dati in una griglia e selezionarne soltanto alcuni e mandarli in stampa.&lt;br /&gt;
Bando alle ciancie e si comincia.&lt;br /&gt;
&lt;br /&gt;
          Dim NumeroFattura As String&lt;br /&gt;
        Dim row As DataGridViewRow&lt;br /&gt;
         For Each row In VwFattureListaDataGridView.Rows&lt;br /&gt;
            If row.Selected = True Then 'se la riga è selezionata&lt;br /&gt;
                'componi il nome del file che andrai a creare&lt;br /&gt;
                NumeroFattura = CInt(row.Cells(2).Value) &amp;amp; "_" &amp;amp; Year(row.Cells(3).Value)&lt;br /&gt;
                Dim nomeFileDestinazione As String = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) &amp;amp; "\Ft " &amp;amp; NumeroFattura &amp;amp; ".pdf"&lt;br /&gt;
                'crea la fonte dati LinqToSql e associala alla fonte dati del report&lt;br /&gt;
                Dim stampa = From report In mydc.vwFattures _&lt;br /&gt;
                      Where report.idFattura = CInt(row.Cells(0).Value) _&lt;br /&gt;
                      Order By report.Posizione _&lt;br /&gt;
                      Select report&lt;br /&gt;
                VwFattureBindingSource.DataSource = stampa&lt;br /&gt;
                'compila i parametri &lt;br /&gt;
                Dim PrintRef As Boolean = chkPrintRef.Checked&lt;br /&gt;
                Dim params(0) As Microsoft.Reporting.WinForms.ReportParameter&lt;br /&gt;
                params(0) = New Microsoft.Reporting.WinForms.ReportParameter("StampaRiferimenti", PrintRef, False)&lt;br /&gt;
                Me.rptFattura.LocalReport.SetParameters(params)&lt;br /&gt;
                Me.rptFattura.RefreshReport()&lt;br /&gt;
&lt;br /&gt;
                'quindi creo il file pdf. &lt;br /&gt;
                Dim warnings As Microsoft.Reporting.WinForms.Warning() = Nothing&lt;br /&gt;
                Dim streamids As String() = Nothing&lt;br /&gt;
                Dim mimeType As String = Nothing&lt;br /&gt;
                Dim encoding As String = Nothing&lt;br /&gt;
                Dim extension As String = Nothing&lt;br /&gt;
                Dim bytes As Byte()&lt;br /&gt;
                bytes = rptFattura.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)&lt;br /&gt;
                Dim fs As New IO.FileStream(nomeFileDestinazione, IO.FileMode.Create)&lt;br /&gt;
                fs.Write(bytes, 0, bytes.Length)&lt;br /&gt;
                fs.Close()&lt;br /&gt;
                'richiama il file pdf appena creato e mandalo in stampa&lt;br /&gt;
                Dim MyProcess As New Process&lt;br /&gt;
                MyProcess.StartInfo.CreateNoWindow = False&lt;br /&gt;
                MyProcess.StartInfo.Verb = "print"&lt;br /&gt;
                MyProcess.StartInfo.FileName = nomeFileDestinazione&lt;br /&gt;
                MyProcess.Start()&lt;br /&gt;
                MyProcess.WaitForExit(10000)&lt;br /&gt;
                MyProcess.CloseMainWindow()&lt;br /&gt;
                MyProcess.Close()&lt;br /&gt;
&lt;br /&gt;
            End If&lt;br /&gt;
        Next&lt;br /&gt;
&lt;br /&gt;
Se vi è piaciuto non dimenticate di comprare il mio romanzo.&lt;br /&gt;
&lt;a href="javascript:void(0);/*1329469055786*/"&gt;http://www.ebookvanilla.it/il-cavaliere-bianco.html&lt;/a&gt;&lt;br /&gt;
troverete qualche personaggio famoso di VBT&amp;amp;T&lt;br /&gt;
&lt;img height="146" width="100" alt="" src="http://images.ebookvanilla.it/ebook/8514.jpg" /&gt;&lt;img src="http://community.visual-basic.it/flavio/aggbug/38053.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/WtFE9X8T7CQ" height="1" width="1"/&gt;</description><dc:creator>Flavio Firmo</dc:creator><feedburner:origLink>http://community.visual-basic.it/flavio/archive/2012/02/17/Stampare-direttamente-un-reportViewer.aspx</feedburner:origLink></item><item><title>WPF 4.5: Live Shaping</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/nhkX_EuTDwc/WPF-4-5-Live-Shaping.aspx</link><pubDate>Sun, 12 Feb 2012 14:31:50 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/02/12/WPF-4-5-Live-Shaping.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38052.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38052.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/02/12/WPF-4-5-Live-Shaping.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38052.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">WPF 4.5: Live Shaping</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;Uno dei difetti che ha contraddistinto WPF fino alla sua versione 4.0 riguarda il fatto che l'interfaccia grafica non riflette automaticamente azioni di ordinamento, filtro e raggruppamento eseguite nei confronti di una &lt;font face="Courier New"&gt;ICollectionView&lt;/font&gt; o, più genericamente, di una collezione.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Il problema è definitivamente risolto in WPF 4.5 grazie a una nuova caratteristica nota come &lt;font color="#800000"&gt;Live Shaping&lt;/font&gt;.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Ho sempre la stessa classe Contact, più una ObservableCollection chiamata Contacts:&lt;/font&gt;&lt;/p&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR: blue"&gt;Imports&lt;/span&gt; System.ComponentModel
 
&lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Contact&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Implements&lt;/span&gt; System.ComponentModel.&lt;span style="COLOR: #2b91af"&gt;INotifyPropertyChanged&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt; LastName &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt; FirstName &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; _age &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Integer&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt; Age &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Integer&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Get&lt;/span&gt;
            &lt;span style="COLOR: blue"&gt;Return&lt;/span&gt; _age
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Get&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Set&lt;/span&gt;(value &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Integer&lt;/span&gt;)
            _age = value
            &lt;span style="COLOR: blue"&gt;RaiseEvent&lt;/span&gt; PropertyChanged(&lt;span style="COLOR: blue"&gt;Me&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;PropertyChangedEventArgs&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"Age"&lt;/span&gt;))
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Set&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Event&lt;/span&gt; PropertyChanged(sender &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Object&lt;/span&gt;, e &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; ComponentModel.&lt;span style="COLOR: #2b91af"&gt;PropertyChangedEventArgs&lt;/span&gt;) &lt;span style="COLOR: blue"&gt;Implements&lt;/span&gt; ComponentModel.&lt;span style="COLOR: #2b91af"&gt;INotifyPropertyChanged&lt;/span&gt;.PropertyChanged
&lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Class&lt;/span&gt;
 
&lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Contacts&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Inherits&lt;/span&gt; System.Collections.ObjectModel.&lt;span style="COLOR: #2b91af"&gt;ObservableCollection&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;Of&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Contact&lt;/span&gt;)
 
&lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Class&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;A differenza del passato, abbiamo ora a disposizione un tipo chiamato &lt;font face="Courier New"&gt;ICollectionViewLiveShaping&lt;/font&gt;, che si usa come una ICollectionView ma che supporta anche delle proprietà booleane chiamate &lt;font color="#800000"&gt;IsLiveSorting&lt;/font&gt;, &lt;font color="#800000"&gt;IsLiveFiltering&lt;/font&gt;, &lt;font color="#800000"&gt;IsLiveGrouping&lt;/font&gt; che, se impostate a True, permettono alla UI di aggiornare automaticamente la presentazione dei dati. Ipotizzando di avere una Window qualunque, supponiamo di popolare una collezione di contatti in questo modo:&lt;/font&gt;&lt;/p&gt;
&lt;font face="Verdana"&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;    &lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt; LiveShapingWindow_Loaded(sender &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Object&lt;/span&gt;, e &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;RoutedEventArgs&lt;/span&gt;) &lt;span style="COLOR: blue"&gt;Handles&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Me&lt;/span&gt;.Loaded
        &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; cnt &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Contacts&lt;/span&gt;
        cnt.Add(&lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Contact&lt;/span&gt; &lt;span style="COLOR: blue"&gt;With&lt;/span&gt; {.Age = 34, .FirstName = &lt;span style="COLOR: #a31515"&gt;"Alessandro"&lt;/span&gt;, .LastName = &lt;span style="COLOR: #a31515"&gt;"Del Sole"&lt;/span&gt;})
        cnt.Add(&lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Contact&lt;/span&gt; &lt;span style="COLOR: blue"&gt;With&lt;/span&gt; {.Age = 44, .FirstName = &lt;span style="COLOR: #a31515"&gt;"Renato"&lt;/span&gt;, .LastName = &lt;span style="COLOR: #a31515"&gt;"Marzaro"&lt;/span&gt;})
        cnt.Add(&lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Contact&lt;/span&gt; &lt;span style="COLOR: blue"&gt;With&lt;/span&gt; {.Age = 18, .FirstName = &lt;span style="COLOR: #a31515"&gt;"Contatto"&lt;/span&gt;, .LastName = &lt;span style="COLOR: #a31515"&gt;"AppenaMaggiorenne"&lt;/span&gt;})
 
 
        &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; view = &lt;span style="COLOR: blue"&gt;CType&lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;CollectionViewSource&lt;/span&gt;.GetDefaultView(cnt), ICollectionViewLiveShaping)
        view.IsLiveSorting = &lt;span style="COLOR: blue"&gt;True&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Me&lt;/span&gt;.DG1.ItemsSource = cnt
 
        view.IsLiveFiltering = &lt;span style="COLOR: blue"&gt;True&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/font&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Dove DG1 è una semplice DataGrid definita, lato XAML, in questo modo (con colonne auto-generate per velocità):&lt;/font&gt;&lt;/p&gt;
&lt;font size="2" face="Consolas"&gt;&lt;font size="2" face="Consolas"&gt;
&lt;p&gt; &lt;/p&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;DataGrid&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt; AutoGenerateColumns&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;="True"&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt; Name&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;="DG1"&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt; ItemsSource&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;="{&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;Binding&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;}"&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt; IsReadOnly&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;="True"/&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Come potete vedere la ICollectionViewLiveShaping si usa in un modo che già conosciamo ma, impostandone la proprietà di interesse su True, otterremo finalmente l'effetto desiderato.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38052.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/nhkX_EuTDwc" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/02/12/WPF-4-5-Live-Shaping.aspx</feedburner:origLink></item><item><title>Windows 8 Developer Portal, Content e Store: Partecipa alla community per migliorare il glossario italiano per i dev</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/Gv-p1_tPh1w/Windows-8-Developer-Portal-Content-e-Store-Partecipa-alla-community.aspx</link><pubDate>Sat, 11 Feb 2012 10:01:22 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/02/11/Windows-8-Developer-Portal-Content-e-Store-Partecipa-alla-community.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38051.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38051.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/02/11/Windows-8-Developer-Portal-Content-e-Store-Partecipa-alla-community.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38051.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">Windows 8 Developer Portal, Content e Store: Partecipa alla community per migliorare il glossario italiano per i dev</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;Come da questo &lt;a href="http://blogs.msdn.com/b/italy/archive/2012/02/09/windows-8-developer-portal-content-e-store-partecipa-alla-community-e-aiutaci-a-migliorare-il-glossario-italiano-di-windows-8-per-i-developer.aspx"&gt;post&lt;/a&gt; di &lt;a href="http://www.geniodelmale.info"&gt;Lorenzo&lt;/a&gt;, MSDN Italia lancia un'iniziativa che permette alla comunità di sviluppatori di contribuire al miglioramento del glossario di Windows 8 in italiano, con particolare riferimento a quella che è la terminologia per sviluppatori.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Il forum è stato aperto il 9 febbraio e lo rimarrà fino al 22 c.m. Se avete avuto modo di dare un'occhiata alla prima developer preview di Windows 8 si tratta indubbiamente di una bella opportunità.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38051.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/Gv-p1_tPh1w" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/02/11/Windows-8-Developer-Portal-Content-e-Store-Partecipa-alla-community.aspx</feedburner:origLink></item><item><title>WPF 4.5: Delay Binding</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/7Ffy389ez5Y/WPF-4-5-Delay-Binding.aspx</link><pubDate>Thu, 09 Feb 2012 20:52:01 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/02/09/WPF-4-5-Delay-Binding.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38050.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38050.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/02/09/WPF-4-5-Delay-Binding.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38050.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">WPF 4.5: Delay Binding</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;Con questo post vorrei iniziare una mini-serie dedicate alle novità di &lt;font color="#800000"&gt;Windows Presentation Foundation&lt;/font&gt; 4.5, ossia quella che sarà la versione disponibile nella ventura release di .NET Framework. Per eseguire il codice chiaramente è necessario avere installato la &lt;a href="http://www.google.it/url?sa=t&amp;amp;rct=j&amp;amp;q=developer%20preview%20visual%20studio%2011&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CCgQFjAA&amp;amp;url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Fvstudio%2Fhh127353&amp;amp;ei=JDQ0T8qgFo_a4QSJ8f2IAg&amp;amp;usg=AFQjCNFOb6Obe3IJdZOLekynsfVUNydZ_w"&gt;Developer Preview di Visual Studio 11&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Vi ricordo che venerdì 17 p.v. terrò una &lt;a href="http://www.communitydays.it/events/communitydays-2012/netfx05/?utm_source=dlvr.it&amp;amp;utm_medium=twitter"&gt;sessione completa&lt;/a&gt; sulle novità della piattaforma ai Community Days 2012.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;In questo post parliamo del &lt;font color="#339966"&gt;Delay Binding&lt;/font&gt;, una feature che all'apparenza può avere scarsa utilità ma che in realtà in alcuni scenari può essere utile. Di cosa si tratta? Sostanzialmente, in un data-binding di tipo &lt;font color="#ff0000"&gt;Two-Way&lt;/font&gt;, è possibile ritardare l'aggiornamento della sorgente dati collegata di un tempo specificato in millisecondi. Questo presuppone che l'UpdateSourceTrigger nel binding sia di tipo PropertyChanged. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;La &lt;a href="http://msdn.microsoft.com/en-us/library/bb613588%28v=vs.110%29.aspx"&gt;documentazione&lt;/a&gt; MSDN in preview fa un esempio calzante, ossia un controllo Slider al cui spostamento il valore collegato non viene aggiornato subito per evitare overhead. Qui invece facciamo un esempio diverso, secondo me più adatto per capire. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Non uso MVVM perchè anche i meno esperti vanno incoraggiati a capire meglio. Ho una banale classe Contact:&lt;/font&gt;&lt;/p&gt;
&lt;font face="Verdana"&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR: blue"&gt;Imports&lt;/span&gt; System.ComponentModel
 
&lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Contact&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Implements&lt;/span&gt; System.ComponentModel.&lt;span style="COLOR: #2b91af"&gt;INotifyPropertyChanged&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; _lastName &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt; LastName &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Get&lt;/span&gt;
            &lt;span style="COLOR: blue"&gt;Return&lt;/span&gt; _lastName
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Get&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Set&lt;/span&gt;(value &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;)
            _lastName = value
            &lt;span style="COLOR: blue"&gt;RaiseEvent&lt;/span&gt; PropertyChanged(&lt;span style="COLOR: blue"&gt;Me&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;PropertyChangedEventArgs&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"LastName"&lt;/span&gt;))
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Set&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; _firstName &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt; FirstName &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Get&lt;/span&gt;
            &lt;span style="COLOR: blue"&gt;Return&lt;/span&gt; _firstName
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Get&lt;/span&gt;
        &lt;span style="COLOR: blue"&gt;Set&lt;/span&gt;(value &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;)
            _firstName = value
            &lt;span style="COLOR: blue"&gt;RaiseEvent&lt;/span&gt; PropertyChanged(&lt;span style="COLOR: blue"&gt;Me&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;PropertyChangedEventArgs&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"FirstName"&lt;/span&gt;))
        &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Set&lt;/span&gt;
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Property&lt;/span&gt;
 
    &lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Event&lt;/span&gt; PropertyChanged(sender &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Object&lt;/span&gt;, e &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; ComponentModel.&lt;span style="COLOR: #2b91af"&gt;PropertyChangedEventArgs&lt;/span&gt;) &lt;span style="COLOR: blue"&gt;Implements&lt;/span&gt; ComponentModel.&lt;span style="COLOR: #2b91af"&gt;INotifyPropertyChanged&lt;/span&gt;.PropertyChanged
&lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Class&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/font&gt;
&lt;p&gt;&lt;font face="Verdana" /&gt;&lt;font face="Verdana"&gt;Viene implementata &lt;font face="Courier New"&gt;INotifyPropertyChanged&lt;/font&gt; per inviare una notifica quando i dati sono modificati. Poi ho una Window così definita:&lt;/font&gt;&lt;/p&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Window&lt;/span&gt;&lt;span style="COLOR: red"&gt; x&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: red"&gt;Class&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"DBWindow"&lt;/span&gt;
   &lt;span style="COLOR: red"&gt; xmlns&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;
   &lt;span style="COLOR: red"&gt; xmlns&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: red"&gt;x&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;
       &lt;span style="COLOR: red"&gt; xmlns&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: red"&gt;local&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"clr-namespace:WpfApplication1"&lt;/span&gt;
   &lt;span style="COLOR: red"&gt; Title&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"DBWindow"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Height&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"300"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Width&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"300"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;    &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Window.Resources&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;local&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Contact&lt;/span&gt;&lt;span style="COLOR: red"&gt; x&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: red"&gt;Key&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"DemoContact"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;    &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Window.Resources&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;    &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="COLOR: red"&gt; DataContext&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="{&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="COLOR: red"&gt; Source&lt;/span&gt;&lt;span style="COLOR: blue"&gt;={&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;StaticResource&lt;/span&gt;&lt;span style="COLOR: red"&gt; DemoContact&lt;/span&gt;&lt;span style="COLOR: blue"&gt;}}&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="COLOR: red"&gt; DataContext&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="{&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="COLOR: blue"&gt;}&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;            &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;TextBox&lt;/span&gt;&lt;span style="COLOR: red"&gt; Text&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="{&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="COLOR: red"&gt; Path&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;FirstName&lt;/span&gt;&lt;span style="COLOR: blue"&gt;,&lt;/span&gt;&lt;span style="COLOR: red"&gt; Mode&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;TwoWay&lt;/span&gt;&lt;span style="COLOR: blue"&gt;,&lt;/span&gt;&lt;span style="COLOR: red"&gt; Delay&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;3000&lt;span style="COLOR: blue"&gt;,&lt;/span&gt;&lt;span style="COLOR: red"&gt; UpdateSourceTrigger&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;PropertyChanged&lt;/span&gt;&lt;span style="COLOR: blue"&gt;}&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Width&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"200"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Height&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"40"&lt;/span&gt;&lt;span style="COLOR: red"&gt; FontSize&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"16"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;            &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;TextBox&lt;/span&gt;&lt;span style="COLOR: red"&gt; Text&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="{&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="COLOR: red"&gt; Path&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;LastName&lt;/span&gt;&lt;span style="COLOR: blue"&gt;,&lt;/span&gt;&lt;span style="COLOR: red"&gt; Mode&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;TwoWay&lt;/span&gt;&lt;span style="COLOR: blue"&gt;,&lt;/span&gt;&lt;span style="COLOR: red"&gt; Delay&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;3000&lt;span style="COLOR: blue"&gt;,&lt;/span&gt;&lt;span style="COLOR: red"&gt; UpdateSourceTrigger&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;PropertyChanged&lt;/span&gt;&lt;span style="COLOR: blue"&gt;}&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Width&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"200"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Height&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"40"&lt;/span&gt;&lt;span style="COLOR: red"&gt; FontSize&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"16"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
 
&lt;span style="COLOR: #a31515"&gt;            &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Button&lt;/span&gt;&lt;span style="COLOR: red"&gt; Width&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"100"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"Button1"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Height&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"40"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Click&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"Button1_Click"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Content&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"Mostra valori"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Margin&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;span style="COLOR: blue"&gt;"0,20,0,0"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;        &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: #a31515"&gt;    &lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Window&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Nelle risorse dichiaro un'istanza della classe Contact da utilizzare come contesto dati della finestra stessa. Ho due TextBox collegate in binding alle rispettive proprietà della classe citata. Come vedete il binding ha ora una nuova proprietà chiamata Delay, che permette di specificare l'intervallo in millisecondi trascorso il quale la UI invierà le modifiche fatte alla sorgente collegata. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;L'evento Click del pulsante è semplice e serve null'altro che a mostrare una stringa contenente il nome e cognome del contatto:&lt;/font&gt; &lt;/p&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;    &lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt; Button1_Click(sender &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Object&lt;/span&gt;, e &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;RoutedEventArgs&lt;/span&gt;)
        &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; contactInstance = &lt;span style="COLOR: blue"&gt;CType&lt;/span&gt;(FindResource(&lt;span style="COLOR: #a31515"&gt;"DemoContact"&lt;/span&gt;), &lt;span style="COLOR: #2b91af"&gt;Contact&lt;/span&gt;)
 
        &lt;span style="COLOR: #2b91af"&gt;MessageBox&lt;/span&gt;.Show(&lt;span style="COLOR: blue"&gt;String&lt;/span&gt;.Concat(contactINstance.FirstName, &lt;span style="COLOR: #a31515"&gt;" "&lt;/span&gt;, contactINstance.LastName))
    &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Per capire come funziona il codice sopra esposto, lanciamo l'applicazione. Inseriamo dei valori e attendiamo tre secondi. Poi facciamo altre modifiche e clicchiamo sul pulsante prima che siano trascorsi i tre secondi specificati. Ci accorgeremo a questo punto che le modifiche fatte non sono state ancora invitate all'oggetto collegato, a causa del delay binding. Trascorso l'intervallo specificato, invece, le modifiche saranno inviate all'oggetto. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Un utilizzo di questo tipo di binding può riguardare oggetti che subiscono continue modifiche (es. testo) e che quindi non necessitano di un update finchè la modifica non si è conclusa.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;&lt;font color="#339966"&gt;Alessandro&lt;/font&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38050.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/7Ffy389ez5Y" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/02/09/WPF-4-5-Delay-Binding.aspx</feedburner:origLink></item><item><title>Windows 8 Beta disponibile dal 29 febbraio</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/2VhEAoeV0CY/Windows-8-Beta-disponibile-dal-29-febbraio.aspx</link><pubDate>Thu, 09 Feb 2012 18:26:51 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/02/09/Windows-8-Beta-disponibile-dal-29-febbraio.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38049.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38049.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/02/09/Windows-8-Beta-disponibile-dal-29-febbraio.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38049.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">Windows 8 Beta disponibile dal 29 febbraio</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;Di solito non scrivo di queste cose se non quando le notizie provengono da uno dei canali MSDN che di solito seguo, ma siccome c'è una notizia da un blog Microsoft, per me vale come ufficiale &lt;img alt="" src="/aspx/providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" /&gt; (al di là dei tanti rumours).&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Nel suo &lt;a href="http://blogs.technet.com/b/feliciano_intini/"&gt;blog&lt;/a&gt; su TechNet Italia, Feliciano Intini comunica, in &lt;a href="http://blogs.technet.com/b/feliciano_intini/archive/2012/02/09/la-windows-8-consumer-preview-aka-windows-8-beta-sar-224-rilasciata-il-29-febbraio.aspx"&gt;questo post&lt;/a&gt;, che Windows 8 Consumer Preview (la Beta, insomma) sarà disponibile a partire dal 29 febbraio in concomitanza con il Mobile World Congress 2012 di Barcellona. Come Feliciano sottolinea, probabilmente questo rilascio fatto a una delle più importanti conferenze per device mobili ha un suo significato importante.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Io a quella data sarò all'MVP Global Summit a Redmond e sono curioso di vedere che tipo di aria si respirerà!&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38049.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/2VhEAoeV0CY" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/02/09/Windows-8-Beta-disponibile-dal-29-febbraio.aspx</feedburner:origLink></item><item><title>Disponibile Kinect per Windows</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/6sv6cA87hPM/Disponibile-Kinect-per-Windows.aspx</link><pubDate>Thu, 02 Feb 2012 09:26:37 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/02/02/Disponibile-Kinect-per-Windows.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38046.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38046.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/02/02/Disponibile-Kinect-per-Windows.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38046.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">Disponibile Kinect per Windows</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;E' di ieri la &lt;/font&gt;&lt;a href="http://blogs.msdn.com/b/kinectforwindows/archive/2012/01/31/kinect-for-windows-is-now-available.aspx"&gt;&lt;font face="Verdana"&gt;notizia&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana"&gt; della disponibilità di Kinect SDK per Windows. Il noto dispositivo precedentemente disponibile solo per XBox ora è anche disponibile, con una licenza commerciale (al prezzo suggerito di $ 249), per sviluppare applicazioni che permettano di interagire col sistema operativo del pc attraverso gesti.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Esiste un &lt;/font&gt;&lt;a href="http://blogs.msdn.com/b/kinectforwindows/"&gt;&lt;font face="Verdana"&gt;blog&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana"&gt; del Team di Kinect per Windows, sul quale potete trovare tutte le ultime novità e le informazioni essenziali per iniziare ad avvicinarsi a questa nuova frontiera di sviluppo, che secondo me avrà delle ottime prospettive soprattutto in ottica futura.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38046.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/6sv6cA87hPM" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/02/02/Disponibile-Kinect-per-Windows.aspx</feedburner:origLink></item><item><title>Community Days 2012: informazioni di dettaglio</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/AtM1xBMabOs/Community-Days-2012-informazioni-di-dettaglio.aspx</link><pubDate>Wed, 01 Feb 2012 22:54:30 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/02/01/Community-Days-2012-informazioni-di-dettaglio.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38045.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38045.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/02/01/Community-Days-2012-informazioni-di-dettaglio.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38045.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">Community Days 2012: informazioni di dettaglio</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;Ci siamo quasi! Tra circa due settimane avrà luogo l'evento community più importante dell'anno, ossia quello dei &lt;a href="http://www.communitydays.it/events/communitydays-2012/"&gt;Community Days 2012&lt;/a&gt;! L'hashtag ufficiale su Twitter è #cdays12.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;La nostra community avrà quest'anno l'onore di partecipare con 2 sessioni, una mia su WPF 4.5 e una di Renato Marzaro su Kinect. Approfitto quindi per ringraziare tutti gli iscritti, circa 700 &lt;img alt="" src="/aspx/providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/tounge_smile.gif" /&gt;, che sono il vero cuore di queste due giornate! &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Oltre a noi, chiaramente, c'è una nutrita agenda di sessioni sulle più recenti novità tecnologiche Microsoft, quindi parliamo di Windows 8, Windows Phone, Windows Azure, ASP.NET MVC, ecc. ecc.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Un sincero ringraziamento anche agli instancabili &lt;a href="http://blogs.aspitalia.com/daniele"&gt;Daniele&lt;/a&gt; e &lt;a href="http://blogs.ugidotnet.org/pape"&gt;Andrea&lt;/a&gt;, che hanno messo in piedi una macchina organizzativa perfetta.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Qualche info di dettaglio, soprattutto di tipo logistico. &lt;/font&gt;&lt;/p&gt;
&lt;h4&gt;&lt;font color="#0000ff" size="2" face="Verdana"&gt;Servizio navetta e come raggiungere la sede&lt;/font&gt;&lt;/h4&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Grazie a Microsoft Italia, è stato predisposto &lt;u&gt;un servizio navetta gratuito&lt;/u&gt;. Ci sono due navette da 50 posti l'una la mattina e due la sera, dal terminal degli autobus sopra la stazione M3 di San Donato. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Orari: &lt;/font&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;Andata: 8.45 e 9:00 &lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font face="Verdana"&gt;Ritorno: 18.45 e 19:00&lt;/font&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Sulla pagina di Microsoft Italia a &lt;/font&gt;&lt;a href="http://www.microsoft.com/italy/newscenter/DoveSiamo.aspx"&gt;&lt;font face="Verdana"&gt;questo indirizzo&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana"&gt; sono riportate le altre modalità per raggiungere la sede.&lt;br /&gt;
Per chi è in auto, l'Innovation Center di Microsoft Italia è dotato di un parcheggio sotterraneo dedicato e di due parcheggi più piccoli, scoperti. &lt;/font&gt;&lt;/p&gt;
&lt;h4&gt;&lt;font color="#0000ff" size="2" face="Verdana"&gt;Cosa portare se partecipate ai lab&lt;/font&gt;&lt;/h4&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Se siete iscritti ad uno dei lab dev, dovete portare con voi il vostro computer portatile. Alla reception vi verrà dato un accesso ad internet usando la guest wifi di Microsoft. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Se partecipate al lab &lt;strong&gt;Web Camp&lt;/strong&gt;, andate su &lt;/font&gt;&lt;a target="_blank" href="http://aspitalia.com/web-camp"&gt;&lt;font face="Verdana"&gt;questa pagina&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana"&gt; e scaricate il materiale specifico. Dovete avere installato VS 2010 SP1, ASP.NET MVC 3 e WebMatrix 2 (beta, va benissimo). &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Per il lab &lt;strong&gt;Windows Phone&lt;/strong&gt;, dovete avere i &lt;/font&gt;&lt;a target="_blank" href="http://www.winphoneitalia.com/sviluppo/"&gt;&lt;font face="Verdana"&gt;tool installati&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana"&gt;. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Per il lab &lt;strong&gt;Azure&lt;/strong&gt;, dovete avere i &lt;/font&gt;&lt;a target="_blank" href="http://www.windowsazure.com/en-us/develop/downloads/"&gt;&lt;font face="Verdana"&gt;tool Azure installati&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana"&gt; ed avere una sottoscrizione Azure già attiva al momento di partecipare al lab. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Vi aspettiamo all'evento! Ci vediamo il 16 e il 17 febbraio!&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38045.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/AtM1xBMabOs" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/02/01/Community-Days-2012-informazioni-di-dettaglio.aspx</feedburner:origLink></item><item><title>Lab su Windows Azure ai Community Days 2012</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/k49CIRiEm90/Lab-su-Windows-Azure-ai-Community-Days-2012.aspx</link><pubDate>Wed, 01 Feb 2012 18:07:06 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/02/01/Lab-su-Windows-Azure-ai-Community-Days-2012.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38044.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38044.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/02/01/Lab-su-Windows-Azure-ai-Community-Days-2012.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38044.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">Lab su Windows Azure ai Community Days 2012</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;Nel ricordarvi che il 16 e 17 febbraio vi aspettiamo ai &lt;a href="http://www.communitydays.it/events/communitydays-2012/"&gt;Community Days 2012&lt;/a&gt;, approfitto per segnalarvi che ci sono ancora pochissimi posti disponibili per il lab su Windows Azure che verrà tenuto il venerdì.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Trattandosi di una ghiotta occasione per conoscere meglio la Cloud e la piattaforma di servizi che Microsoft ha creato per essa, direi che fareste bene ad iscrivervi &lt;img alt="" src="/aspx/providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Tutte le info &lt;a href="http://www.communitydays.it/events/communitydays-2012/"&gt;qui&lt;/a&gt;. Ricordatevi di installare l'&lt;a href="http://www.windowsazure.com/en-us/develop/downloads/"&gt;SDK&lt;/a&gt; di Windows Azure sul vostro pc.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38044.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/k49CIRiEm90" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/02/01/Lab-su-Windows-Azure-ai-Community-Days-2012.aspx</feedburner:origLink></item><item><title>Com'è andato l'evento con DotNetLiguria del 27 gennaio</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/91odTvauO8Y/Come-andato-levento-con-DotNetLiguria-del-27-gennaio.aspx</link><pubDate>Tue, 31 Jan 2012 16:54:51 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/01/31/Come-andato-levento-con-DotNetLiguria-del-27-gennaio.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38043.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38043.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/01/31/Come-andato-levento-con-DotNetLiguria-del-27-gennaio.aspx#comment</comments><slash:comments>1</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38043.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">Com'è andato l'evento con DotNetLiguria del 27 gennaio</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;Venerdì 27 gennaio ho avuto il piacere di tenere a Genova una sessione di introduzione a Visual Studio LightSwitch nel &lt;a href="http://www.dotnetliguria.net/eventi/workshop-1-anno-2012"&gt;primo workshop&lt;/a&gt; del 2012 della community &lt;a href="http://www.dotnetliguria.net"&gt;DotNetLiguria&lt;/a&gt;. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" width="180" height="258" src="http://www.dotnetliguria.net/Media/Default/HtmlWidget/lightswitch.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Sono molto soddisfatto della sessione, anche perchè è stata seguita da sviluppatori con skill già medio-alti su .NET e non provenienti (almeno attualmente &lt;img alt="" src="/aspx/providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" /&gt;) dai mondi VB 6 e Access. Domande precise e circostanziate, mi è piaciuto molto. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Tendenzialmente, si sa, lo sviluppatore esperto non gradisce molto determinate limitazioni e imposizioni, ma in LightSwitch questo è ripagato dal tempo (molto) che si risparmia poichè non c'è da fare tutte le operazioni di generazione di roba c.d. "plumbing" (interfaccia, pulsanti, creazione DAL, ecc. ecc.).&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Circa il resto dell'evento, mi ha particolarmente colpito la lucidità che i partecipanti hanno dimostrato nell'intendere Silverlight, come dimostrato nella prima roundtable. Molto interessante la sessione sui Code Contracts di &lt;font color="#800000"&gt;Claudio Masieri&lt;/font&gt;, che ha saputo utilizzare un approccio molto friendly alla cosa.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Le slide della mia sessione sono disponibili a questo &lt;a href="http://www.dotnetliguria.net/Media/Default/Workshops/2012Jan/adsLightSwitchTourDotNetLiguria_27012012.pdf"&gt;indirizzo&lt;/a&gt;. Infine, un ringraziamento speciale a &lt;a href="http://www.iamraf.net"&gt;Raf&lt;/a&gt; e ai ragazzi della community per la calorosa accoglienza e per l'ottimo pomeriggio/pizza!&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38043.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/91odTvauO8Y" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/01/31/Come-andato-levento-con-DotNetLiguria-del-27-gennaio.aspx</feedburner:origLink></item><item><title>Windows Phone: cambiare skin all'emulatore</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/FsimcwLseKg/Windows-Phone-cambiare-skin-allemulatore.aspx</link><pubDate>Thu, 26 Jan 2012 21:42:21 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/01/26/Windows-Phone-cambiare-skin-allemulatore.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38042.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38042.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/01/26/Windows-Phone-cambiare-skin-allemulatore.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38042.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">Windows Phone: cambiare skin all'emulatore</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;Stanchi della skin di default dell'emulatore di Windows Phone? Niente di più semplice: cambiatela! &lt;img alt="" src="/aspx/providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/teeth_smile.gif" /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;C'è un bellissimo progetto su CodePlex chiamato &lt;a href="http://wp7emuskinswitcher.codeplex.com/"&gt;Windows Phone 7 Emulator Skin Switcher &lt;/a&gt;che vi permette di scegliere tra ben 25 skin diverse che riproducono l'estetica dei dispositivi più diffusi.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Io, ovviamente, ho ora la skin del Nokia Lumia &lt;img alt="" src="/aspx/providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/wink_smile.gif" /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38042.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/FsimcwLseKg" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/01/26/Windows-Phone-cambiare-skin-allemulatore.aspx</feedburner:origLink></item><item><title>Windows Phone: effetto turn-style nella navigazione tra pagine</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/_B6euOKuh6M/Windows-Phone-effetto-turn-style-nella-navigazione-tra-pagine.aspx</link><pubDate>Thu, 26 Jan 2012 21:33:55 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/01/26/Windows-Phone-effetto-turn-style-nella-navigazione-tra-pagine.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38041.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38041.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/01/26/Windows-Phone-effetto-turn-style-nella-navigazione-tra-pagine.aspx#comment</comments><slash:comments>1</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38041.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">Windows Phone: effetto turn-style nella navigazione tra pagine</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;Vi segnalo questo bellissimo &lt;a href="http://www.winphoneitalia.com/script/55/Effetto-Turnstile-Pagine-Windows-Phone-Toolkit.aspx"&gt;&lt;font color="#ff0000"&gt;post&lt;/font&gt;&lt;/a&gt; dell'amico Cristian Civera il quale ci spiega come applicare l'effetto di transizione che vediamo normalmente nella navigazione tra pagine in Windows Phone anche all'interno delle nostre app.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Cristian, secondo me, ha sempre avuto la grande dote di spiegare in modo semplice anche gli argomenti più complessi e questo post non è da meno.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38041.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/_B6euOKuh6M" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/01/26/Windows-Phone-effetto-turn-style-nella-navigazione-tra-pagine.aspx</feedburner:origLink></item><item><title>Address Book Sample per LightSwitch</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/scRWepRDqE4/Address-Book-Sample-per-LightSwitch.aspx</link><pubDate>Thu, 26 Jan 2012 21:26:36 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/01/26/Address-Book-Sample-per-LightSwitch.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38040.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38040.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/01/26/Address-Book-Sample-per-LightSwitch.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38040.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">Address Book Sample per LightSwitch</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;Beth Massi ha pubblicato l'esempio completo, chiamato &lt;a href="http://code.msdn.microsoft.com/Begining-LightSwitch-508763ea"&gt;Address Book&lt;/a&gt;, a corredo della serie di post intitolata "&lt;font color="#800000"&gt;Beginning Visual Studio LightSwitch&lt;/font&gt;", che potete trovare in questo suo &lt;a href="http://blogs.msdn.com/b/bethmassi/archive/2012/01/26/beginning-lightswitch-address-book-sample.aspx"&gt;post&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Nel citato post è anche disponibile l'elenco completo della serie di articoli che vi permetteranno di comprendere ancora meglio questo speciale ambiente di sviluppo.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38040.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/scRWepRDqE4" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/01/26/Address-Book-Sample-per-LightSwitch.aspx</feedburner:origLink></item><item><title>SQL: Backup automatici con Nant</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/Th175gZu4LM/SQL-Backup-automatici-con-Nant.aspx</link><pubDate>Mon, 23 Jan 2012 21:44:31 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/tdj/archive/2012/01/23/SQL-Backup-automatici-con-Nant.aspx</guid><wfw:comment>http://community.visual-basic.it/tdj/comments/38039.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/tdj/comments/commentRss/38039.aspx</wfw:commentRss><comments>http://community.visual-basic.it/tdj/archive/2012/01/23/SQL-Backup-automatici-con-Nant.aspx#comment</comments><slash:comments>1</slash:comments><trackback:ping>http://community.visual-basic.it/tdj/services/trackbacks/38039.aspx</trackback:ping><source url="http://community.visual-basic.it/tdj/rss.aspx">SQL: Backup automatici con Nant</source><description>&lt;p&gt;Chi utilizza la versione Express di SQL Server sa bene che una delle differenze rispetto alle versioni “Full” è l’assenza del SQL Server Agent, un processo fondamentale per schedulare le diverse attività sul server. Una di queste è il backup di uno o più database che non dovrebbe mai mancare su un server!&lt;/p&gt; &lt;p&gt;Naturalmente esistono dei tools sia a pagamento che gratuiti per colmare questa lacuna ma si può ovviare al problema anche utilizzando strumenti non direttamente ricollegabili al mondo SQL.&lt;br /&gt;Uno di questi è &lt;strong&gt;&lt;a href="http://nant.sourceforge.net/" target="_blank"&gt;NAnt&lt;/a&gt;,&lt;/strong&gt; un Build Tool ossia un framework per la creazione di script di build (in questo caso per .NET).&lt;br /&gt;Senza entrare troppo nel dettaglio, si tratta di creare uno script che esegue una serie di task (chiamati Target) in maniera più o meno strutturata.&lt;br /&gt;Nel nostro caso vogliamo creare uno script di backup di un database compattato in un archivio ZIP.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Installazione di Nant&lt;br /&gt;&lt;/strong&gt;Per prima cosa scarichiamo NAnt dal &lt;a href="http://sourceforge.net/projects/nant/files/nant/0.91/" target="_blank"&gt;Download NAnt&lt;/a&gt;. Non esiste un setup automatico ma bisogna semplicemente scompattare il contenuto del file .ZIP in una cartella qualunque.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Creazione dello script&lt;br /&gt;&lt;/strong&gt;NAnt è basato su file script chiamati Build File che non sono altro che file xml con estensione .build. Ecco il nostro file db.backup.build:&lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:eca607c8-decf-4b79-8af8-043388a505dd" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: xml"&gt;&amp;lt;?xml version="1.0"?&amp;gt;
&amp;lt;project default="backup"&amp;gt;
    &amp;lt;property name="backup.path" value="E:\Backup" /&amp;gt;
    &amp;lt;property name="backup.name" value="" /&amp;gt;
    &amp;lt;property name="backup-date" 
                    value="${datetime::get-year(current-date)}${string::pad-left(datetime::get-month(current-date),2,'0')}${string::pad-left(datetime::get-day(current-date),2,'0')}" /&amp;gt;
    &amp;lt;property name="filename" value="${backup.name}_${backup-date}" /&amp;gt;
	
    &amp;lt;target name="backup"&amp;gt;
	&amp;lt;echo message="Running backup... ${datetime::now()}" failonerror="False" /&amp;gt;
	&amp;lt;exec program="sqlcmd" 
                          commandline="-S .\sqlexpress -i &amp;amp;quot;E:\backup\sql\database.backup.sql&amp;amp;quot;  
                          -v dbname=${backup.name} filename=${filename} path=&amp;amp;quot;${backup.path}&amp;amp;quot;
                          -o &amp;amp;quot;${backup.path}\${filename}.log&amp;amp;quot;" /&amp;gt;
	&amp;lt;call target="zip" /&amp;gt;
    &amp;lt;/target&amp;gt;
	
     &amp;lt;target name="zip"&amp;gt;
	&amp;lt;property name="backup.file" value="${backup.path}\${filename}.bak" /&amp;gt;
	&amp;lt;if test="${file::exists(backup.file)}"&amp;gt;
		&amp;lt;echo message="Compressing..." failonerror="False" /&amp;gt;
		&amp;lt;zip zipfile="${backup.path}\${filename}.zip"&amp;gt;
			&amp;lt;fileset basedir="${backup.path}"&amp;gt;
    			    &amp;lt;include name="${filename}.bak" /&amp;gt;
			&amp;lt;/fileset&amp;gt;
		&amp;lt;/zip&amp;gt;
		&amp;lt;delete file="${backup.path}\${filename}.bak" /&amp;gt;
	&amp;lt;/if&amp;gt;
    &amp;lt;/target&amp;gt;
&amp;lt;/project&amp;gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Lo script definisce, all’inizio, delle varibili identificate dall’elemento &lt;em&gt;&amp;lt;property&amp;gt;&lt;/em&gt; utilizzate nei vari task con la sintassi &lt;em&gt;${nome_variabile}. &lt;/em&gt;Da notare la variabile filename che identifica il nome del file finale composto dal nome del database e la data corrente calcolata dalla variabile &lt;em&gt;backup-date&lt;/em&gt; nel formato yyyymmdd.&lt;/p&gt;
&lt;p&gt;I task sono due. Il primo, “backup”, esegue il backup del database utilizzando l’utility &lt;strong&gt;sqlcmd&lt;/strong&gt; per eseguire il file script database.backup.sql:&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:ab788633-13ee-4de9-a1d1-5c922d873645" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: sql"&gt;declare @filename nvarchar(500)
set @filename='$(path)\$(filename).bak' 

declare @dbname varchar(255)
set @dbname = '$(dbname)'

BACKUP DATABASE @dbname
	TO  DISK = @filename
WITH 
	NOFORMAT, 
	NOINIT,  
	NAME = @dbname,
	SKIP, 
	STATS = 10;
GO&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Si tratta di un semplice comando BACKUP che sfrutta le variabili identificate da &lt;em&gt;$(nome_variabile)&lt;/em&gt; che sono valorizzate sternamente utilizzando l’opzione &lt;em&gt;–v variabile=valore&lt;/em&gt; del comando sqlcmd.&lt;/p&gt;
&lt;p&gt;Il secondo task, “zip”, è lo zip del backup utilizzando un task predefinito di NAnt chiamato &lt;em&gt;&amp;lt;zip&amp;gt;&lt;/em&gt; nel quale si specificano i file da includere nell’archivio mediante l’uso dell’elemtno &lt;em&gt;&amp;lt;fileset&amp;gt;…&amp;lt;/fileset&amp;gt;. &lt;br /&gt;&lt;/em&gt;L’ultima operazione è eliminare il backup con la funzione&lt;em&gt; &amp;lt;delete /&amp;gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Ora non ci resta che provare lo script eseguendo questo comando utilizzando la shell di Windows (cmd):&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:a1cbc5df-86df-45e3-b152-6554aeba0a7a" class="wlWriterEditableSmartContent"&gt;&lt;pre class="brush: powershell"&gt;c:\&amp;gt; nant.exe -buildfile:E:\Backup\db.backup.build -D:backup.name=Northwind&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I parametri specificati sono due:&lt;/p&gt;
&lt;p&gt;1) buildfile: il path del nostro script (in questo esempio in E:\backup);&lt;/p&gt;
&lt;p&gt;2) D: valorizza le &amp;lt;property&amp;gt; definite dello script. Nell’esempio specifichiamo il nome del database valorizzando la property &lt;em&gt;backup.name&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Se tutto ha funzionato bene avremo il nostro backup zippato. A questo punto possiamo schedulare il tutto con il Task Scheduler di Windows &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.ingresso-libero.it/blog/SQL-Backup-automatici-con-Nant_9AC4/wlEmoticon-smile.png" /&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/tdj/aggbug/38039.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/Th175gZu4LM" height="1" width="1"/&gt;</description><dc:creator>Antonio "tdj" Catucci</dc:creator><feedburner:origLink>http://community.visual-basic.it/tdj/archive/2012/01/23/SQL-Backup-automatici-con-Nant.aspx</feedburner:origLink></item><item><title>Interessanti opportunit&amp;agrave; al .Net Campus 2012</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/QAXfcJKkNbs/Interessanti-opportunitagrave-al-Net-Campus-2012.aspx</link><pubDate>Fri, 20 Jan 2012 10:04:50 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Diego/archive/2012/01/20/Interessanti-opportunitagrave-al-Net-Campus-2012.aspx</guid><wfw:comment>http://community.visual-basic.it/Diego/comments/38032.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Diego/comments/commentRss/38032.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Diego/archive/2012/01/20/Interessanti-opportunitagrave-al-Net-Campus-2012.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Diego/services/trackbacks/38032.aspx</trackback:ping><source url="http://community.visual-basic.it/Diego/rss.aspx">Interessanti opportunit&amp;agrave; al .Net Campus 2012</source><description>&lt;p&gt;Dall'organizzazione veniamo informati sulle novità relative all'evento, e io ve le comunico volentieri:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;da oggi si è aperto il contest "&lt;a href="http://newsletter.devleap.com/t.aspx?n=75&amp;amp;l=720" target="_blank"&gt;progetti e idee&lt;/a&gt;": puoi pubblicare la tua idea di applicazione sul sito e farla valutare agli sponsor.       &lt;br /&gt;Le 5 migliori proposte potranno essere presentate al .NET Campus Roma e la migliore proposta value uno stage retribuito in Avanade !&lt;/li&gt;    &lt;li&gt;abbiamo pubblicato i primi &lt;a href="http://newsletter.devleap.com/t.aspx?n=75&amp;amp;l=722" target="_blank"&gt;annunci di lavoro&lt;/a&gt; degli sponsor sul sito:      &lt;br /&gt;puoi segnalare la tua candidatura direttamente dal sito.&lt;/li&gt;    &lt;li&gt;sul sito puoi inoltre pubblicare il tuo &lt;a href="http://newsletter.devleap.com/t.aspx?n=75&amp;amp;l=721" target="_blank"&gt;profilo tecnico&lt;/a&gt; per farti      &lt;br /&gt;conoscere ed essere contattato dagli sponsor dell'evento.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Quindi, &lt;a href="http://www.dotnetcampus.it/" target="_blank"&gt;iscrivetevi&lt;/a&gt; :D:D:D&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Diego/aggbug/38032.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/QAXfcJKkNbs" height="1" width="1"/&gt;</description><dc:creator>Diego Cattaruzza</dc:creator><feedburner:origLink>http://community.visual-basic.it/Diego/archive/2012/01/20/Interessanti-opportunitagrave-al-Net-Campus-2012.aspx</feedburner:origLink></item><item><title>Windows Phone: salvare una foto dal Web all'hub sul device (Visual Basic)</title><link>http://feedproxy.google.com/~r/VisualBasicTipsTricksBlogs/~3/8FSlBYD681M/Windows-Phone-salvare-una-foto-dal-Web-allhub-sul-device.aspx</link><pubDate>Thu, 19 Jan 2012 18:24:55 GMT</pubDate><guid isPermaLink="false">http://community.visual-basic.it/Alessandro/archive/2012/01/19/Windows-Phone-salvare-una-foto-dal-Web-allhub-sul-device.aspx</guid><wfw:comment>http://community.visual-basic.it/Alessandro/comments/38031.aspx</wfw:comment><wfw:commentRss>http://community.visual-basic.it/Alessandro/comments/commentRss/38031.aspx</wfw:commentRss><comments>http://community.visual-basic.it/Alessandro/archive/2012/01/19/Windows-Phone-salvare-una-foto-dal-Web-allhub-sul-device.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://community.visual-basic.it/Alessandro/services/trackbacks/38031.aspx</trackback:ping><source url="http://community.visual-basic.it/Alessandro/rss.aspx">Windows Phone: salvare una foto dal Web all'hub sul device (Visual Basic)</source><description>&lt;p&gt;&lt;font face="Verdana"&gt;La piattaforma di sviluppo per Windows Phone mette a disposizione una serie di API per l'interazione con il Pictures Hub, che è poi il posto in cui vengono memorizzate le foto.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Una richiesta molto frequente è quella di poter salvare nel device foto da Internet, dato il loro indirizzo Web. Posto che ci siamo accertati di avere il permesso di poterlo fare &lt;img alt="" src="/aspx/providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" /&gt;, ricorriamo a una serie di strumenti. Innanzitutto usiamo la classe WebClient per eseguire il download asincrono della foto. Quindi spostiamo il suo contenuto fatto di byte in un file all'interno dell'isolated storage, per poi eseguire il salvataggio vero e proprio.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Per interagire in modo rapido con l'hub delle foto è conveniente utilizzare la classe MediaLibrary (che non fa solo questo), messa a disposizione dall'assembly Microsoft.Xna.Framework. Tale assembly, al quale dobbiamo necessariamente aggiungere un riferimento nel nostro progetto, è specifico per i giochi sviluppati con XNA ma si integra perfettamente con le app.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Il codice che ci permette di eseguire questa operazione non è affatto complicato, richiede solo un po' di dimestichezza con gli stream. Eccolo, con i commenti che facilitano la lettura:&lt;/font&gt;&lt;/p&gt;
&lt;font face="Verdana"&gt;
&lt;pre style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR: green"&gt;'The following Imports directives are required&lt;/span&gt;
&lt;span style="COLOR: green"&gt;'Imports System.Windows.Resources&lt;/span&gt;
&lt;span style="COLOR: green"&gt;'Imports System.IO&lt;/span&gt;
&lt;span style="COLOR: green"&gt;'Imports Microsoft.Xna.Framework.Media&lt;/span&gt;
&lt;span style="COLOR: green"&gt;'Imports System.IO.IsolatedStorage&lt;/span&gt;
 
&lt;span style="COLOR: blue"&gt;Private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt; SavePictureToHub(webAddress &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Uri&lt;/span&gt;, pictureName &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;String&lt;/span&gt;)
    &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; client &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;WebClient&lt;/span&gt;()
    &lt;span style="COLOR: blue"&gt;AddHandler&lt;/span&gt; client.OpenReadCompleted, &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;(sender &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Object&lt;/span&gt;, e &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;OpenReadCompletedEventArgs&lt;/span&gt;)
                                             &lt;span style="COLOR: green"&gt;'Get the result of the download operation as a stream&lt;/span&gt;
                                             &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; resInfo &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;StreamResourceInfo&lt;/span&gt;(e.Result, &lt;span style="COLOR: blue"&gt;Nothing&lt;/span&gt;)
                                             &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; reader &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;StreamReader&lt;/span&gt;(resInfo.Stream)
 
                                             &lt;span style="COLOR: green"&gt;'Get a reference to the isolated storage&lt;/span&gt;
                                             &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; store = IsolatedStorageFile.GetUserStoreForApplication
 
                                             &lt;span style="COLOR: green"&gt;'Read the downloaded stream&lt;/span&gt;
                                             &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; contents &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Byte&lt;/span&gt;()
                                             &lt;span style="COLOR: blue"&gt;Using&lt;/span&gt; bReader &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;BinaryReader&lt;/span&gt;(reader.BaseStream)
                                                 contents = bReader.ReadBytes(&lt;span style="COLOR: blue"&gt;CInt&lt;/span&gt;(reader.BaseStream.Length))
                                             &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Using&lt;/span&gt;
 
                                             &lt;span style="COLOR: green"&gt;'Move the downloaded stream to a temp file into the isolated storage&lt;/span&gt;
                                             &lt;span style="COLOR: blue"&gt;Using&lt;/span&gt; fStream &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; IsolatedStorage.&lt;span style="COLOR: #2b91af"&gt;IsolatedStorageFileStream&lt;/span&gt; = store.CreateFile(pictureName)
                                                 fStream.Write(contents, 0, contents.Length)
                                             &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Using&lt;/span&gt;
 
                                             &lt;span style="COLOR: green"&gt;'Save the picture to the Pictures hub (Saved pictures)&lt;/span&gt;
                                             &lt;span style="COLOR: blue"&gt;Using&lt;/span&gt; rStream &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IsolatedStorageFileStream&lt;/span&gt;(pictureName, &lt;span style="COLOR: #2b91af"&gt;FileMode&lt;/span&gt;.Open, store)
                                                 &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; ml &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;MediaLibrary&lt;/span&gt;
                                                 ml.SavePicture(pictureName, rStream)
                                             &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Using&lt;/span&gt;
 
                                             reader.Close()
 
                                             &lt;span style="COLOR: green"&gt;'Remove the temp file from the isolated storage&lt;/span&gt;
                                             store.DeleteFile(pictureName)
                                         &lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;
 
    client.OpenReadAsync(webAddress)
&lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/font&gt;
&lt;p&gt;&lt;font face="Verdana"&gt;Per una comodità personale uso le statement lambda dove posso, chiaramente si poteva incapsulare il codice della sub 'nidificata' in un delegate separato. L'unica cosa di cui tener conto (oltre, come detto, ad avere il permesso di scaricare la foto) è che le immagini verranno salvate nell'album chiamato Foto Salvate.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#339966" face="Verdana"&gt;&lt;strong&gt;&lt;em&gt;Alessandro&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://community.visual-basic.it/Alessandro/aggbug/38031.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/VisualBasicTipsTricksBlogs/~4/8FSlBYD681M" height="1" width="1"/&gt;</description><dc:creator>Alessandro Del Sole</dc:creator><feedburner:origLink>http://community.visual-basic.it/Alessandro/archive/2012/01/19/Windows-Phone-salvare-una-foto-dal-Web-allhub-sul-device.aspx</feedburner:origLink></item></channel></rss>

