<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Th3nu11's Weblog</title>
	<atom:link href="http://th3nu11.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://th3nu11.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Thu, 17 Jul 2008 13:31:59 +0000</lastBuildDate>
	<language>it</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='th3nu11.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Th3nu11's Weblog</title>
		<link>http://th3nu11.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://th3nu11.wordpress.com/osd.xml" title="Th3nu11&#039;s Weblog" />
	<atom:link rel='hub' href='http://th3nu11.wordpress.com/?pushpress=hub'/>
		<item>
		<title>MSDTC</title>
		<link>http://th3nu11.wordpress.com/2008/07/17/msdtc/</link>
		<comments>http://th3nu11.wordpress.com/2008/07/17/msdtc/#comments</comments>
		<pubDate>Thu, 17 Jul 2008 13:26:51 +0000</pubDate>
		<dc:creator>th3nu11</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MSDTC]]></category>
		<category><![CDATA[MSMQ]]></category>

		<guid isPermaLink="false">http://th3nu11.wordpress.com/?p=60</guid>
		<description><![CDATA[Ho cambiato pc e ho dovuto installare le code di win! Inserisco il cd di xp, &#8220;Add Windows Components&#8221;, seleziono &#8220;Message Queuing&#8221; e faccio partire l&#8217;installazione..risultato: &#8220;The Message Queuing service depends on the following nonexistent service: MSDTC!&#8221; Inizio ad indagagare sul come risolvere il problema e trovo questo link! Quindi eseguo &#8220;msdtc -install&#8221; e nella [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=60&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ho cambiato pc e ho dovuto installare le code di win!</p>
<p>Inserisco il cd di xp, &#8220;Add Windows Components&#8221;, seleziono &#8220;Message Queuing&#8221; e faccio partire l&#8217;installazione..risultato:</p>
<p><em>&#8220;The Message Queuing service depends on the following nonexistent service: MSDTC!&#8221;</em></p>
<p>Inizio ad indagagare sul come risolvere il problema e trovo <a href="http://stevenharman.net/blog/archive/2007/03/27/SQL-Server-Installation-and-MSDTC.aspx">questo link!</a></p>
<p>Quindi eseguo <em>&#8220;msdtc -install&#8221;</em> e nella pagina dei servizi faccio partire il servizio <em>Distributed Transaction Coordinator!</em><br />
(<a href="http://www.theberry.tk/">Grazie Marco per l&#8217;aiuto =D </a>)</p>
<p>Riprovo l&#8217;installazione ma ancora errore, sta volta però sembra un problema di configurazione.<br />
Mi rimetto a cercare e trovo <a href="http://blogs.msdn.com/florinlazar/archive/2004/06/18/159127.aspx">quest&#8217;altro link che spiega come impostare il MSDTC.</a></p>
<p>Per farlo basta andare su </p>
<p>Pannello di controllo -&gt; Administrative Tools -&gt; Component Service, espandere Component Service, poi Computers e selezionare le proprietà di My Computer. A questo punto selzionare la TAB MSDTC e cliccare su &#8220;Security Configuration&#8221;</p>
<p><a href="http://blogs.msdn.com/florinlazar/archive/2004/06/18/159127.aspx">Nel link di prima è</a> indicato come impostare correttamente la security.. sarò onesto..avendone le palle piene io ho attivato qualsiasi cosa si potesse abilitare!! <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/th3nu11.wordpress.com/60/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/th3nu11.wordpress.com/60/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/th3nu11.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/th3nu11.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/th3nu11.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/th3nu11.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/th3nu11.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/th3nu11.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/th3nu11.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/th3nu11.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/th3nu11.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/th3nu11.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/th3nu11.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/th3nu11.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/th3nu11.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/th3nu11.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=60&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://th3nu11.wordpress.com/2008/07/17/msdtc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/32fae2dfba6cacd3bfe85c8826a33377?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">th3nu11</media:title>
		</media:content>
	</item>
		<item>
		<title>Div &amp; Silverlight</title>
		<link>http://th3nu11.wordpress.com/2008/07/15/div-silverlight/</link>
		<comments>http://th3nu11.wordpress.com/2008/07/15/div-silverlight/#comments</comments>
		<pubDate>Tue, 15 Jul 2008 10:12:47 +0000</pubDate>
		<dc:creator>th3nu11</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Div]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windowless]]></category>
		<category><![CDATA[Z-Index]]></category>

		<guid isPermaLink="false">http://th3nu11.wordpress.com/?p=59</guid>
		<description><![CDATA[Ultimamente sto giocando con silverlight! Finalmente ho integrato un oggetto SL in una mia pagina, ne invoka un JS che visualizza una tastiera digitale e.. la tastiera appare sotto il mio SL :S Dopo un momento di terrore (sì terrore, perchè sarei stato rovinato se non si fosse potuto far nulla ) ho trovato questo [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=59&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ultimamente sto giocando con silverlight! </p>
<p>Finalmente ho integrato un oggetto SL in una mia pagina, ne invoka un JS che visualizza una tastiera digitale e.. la tastiera appare sotto il mio SL :S</p>
<p>Dopo un momento di terrore (sì terrore, perchè sarei stato rovinato se non si fosse potuto far nulla <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  ) ho trovato <a href="http://blog.boschin.it/archive/2007/12/28/Silverlight-Overlay-di-HTML.aspx">questo post!</a></p>
<p>alla fine è più banale di quanto pensassi..e mi son risparmiato diverse ore di lavoro <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><code>&lt;asp:Silverlight ID=&quot;Xaml1&quot; runat=&quot;server&quot; Source=&quot;~/ClientBin/MySLPage.xap&quot; MinimumVersion=&quot;2.0.30523&quot; Width=&quot;100%&quot; Height=&quot;100%&quot; <strong>Windowless=&quot;true&quot;</strong>  /&gt;</code></p>
<p> <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/th3nu11.wordpress.com/59/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/th3nu11.wordpress.com/59/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/th3nu11.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/th3nu11.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/th3nu11.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/th3nu11.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/th3nu11.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/th3nu11.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/th3nu11.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/th3nu11.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/th3nu11.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/th3nu11.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/th3nu11.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/th3nu11.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/th3nu11.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/th3nu11.wordpress.com/59/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=59&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://th3nu11.wordpress.com/2008/07/15/div-silverlight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/32fae2dfba6cacd3bfe85c8826a33377?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">th3nu11</media:title>
		</media:content>
	</item>
		<item>
		<title>Impedire la chiusura del browser da JS</title>
		<link>http://th3nu11.wordpress.com/2008/05/22/impedire-la-chiusura-del-browser-da-js/</link>
		<comments>http://th3nu11.wordpress.com/2008/05/22/impedire-la-chiusura-del-browser-da-js/#comments</comments>
		<pubDate>Thu, 22 May 2008 08:44:46 +0000</pubDate>
		<dc:creator>th3nu11</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[JS]]></category>

		<guid isPermaLink="false">http://th3nu11.wordpress.com/?p=58</guid>
		<description><![CDATA[Ho una paginaweb con dei dati modificati e voglio che questo venga notificato se si cerca di aggiornare o chiudere il browser. Per farlo è sufficiente impostare un metodo sul onbeforeunload &#60;script language=&#34;javascript&#34; type=&#34;text/javascript&#34;&#62; window.onbeforeunload = checkUnload; &#60;/script&#62; e poi definire tale metodo (checkUnload). function checkUnload() { if(IsDataChanged()) { return ("There are unsaved changes in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=58&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ho una paginaweb con dei dati modificati e voglio che questo venga notificato se si cerca di aggiornare o chiudere il browser.</p>
<p>Per farlo è sufficiente impostare un metodo sul <em>onbeforeunload</em></p>
<p><code>&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;<br />
        window.onbeforeunload = checkUnload;<br />
 &lt;/script&gt;<br />
</code></p>
<p>e poi definire tale metodo (<em>checkUnload</em>).<br />
<code>function checkUnload()<br />
{<br />
    if(IsDataChanged())<br />
    {<br />
        return ("There are unsaved changes in the page! Do you want to continue?");<br />
    }<br />
}</code></p>
<p>Questo metodo ritorna(solo nel caso in cui i dati risultino modificati) la frase che, al momento della chiusura/aggiornamento del webbrowser, verrà proposta all&#8217;utente che dovrà scegliere se continuare o annullare!</p>
<p>Nel caso in cui invece i dati non siano stati modificati non ritornerà nulla e la navigazione continuerà normalmente.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/th3nu11.wordpress.com/58/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/th3nu11.wordpress.com/58/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/th3nu11.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/th3nu11.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/th3nu11.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/th3nu11.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/th3nu11.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/th3nu11.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/th3nu11.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/th3nu11.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/th3nu11.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/th3nu11.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/th3nu11.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/th3nu11.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/th3nu11.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/th3nu11.wordpress.com/58/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=58&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://th3nu11.wordpress.com/2008/05/22/impedire-la-chiusura-del-browser-da-js/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/32fae2dfba6cacd3bfe85c8826a33377?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">th3nu11</media:title>
		</media:content>
	</item>
		<item>
		<title>XMLNS</title>
		<link>http://th3nu11.wordpress.com/2008/04/23/xmlns/</link>
		<comments>http://th3nu11.wordpress.com/2008/04/23/xmlns/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 13:30:17 +0000</pubDate>
		<dc:creator>th3nu11</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[assembly]]></category>
		<category><![CDATA[xaml]]></category>
		<category><![CDATA[Xmlns]]></category>
		<category><![CDATA[XmlnsDefinition]]></category>

		<guid isPermaLink="false">http://th3nu11.wordpress.com/?p=36</guid>
		<description><![CDATA[A volte si rende necessario importare un namespace per poter utilizzare un proprio tipo in XAML. Se ad esempio avessimo una classe namespace PlayWithSTYLE.Item { public class Person { public string Name { get; set; } public string SName { get; set; } } } nel caso in cui faccia parte dello stesso Assembly dello [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=36&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A volte si rende necessario importare un namespace per poter utilizzare un proprio tipo in XAML.</p>
<p>Se ad esempio avessimo una classe</p>
<p><code>namespace PlayWithSTYLE.Item<br />
{<br />
public class Person<br />
{<br />
public string Name { get; set; }<br />
public string SName { get; set; }<br />
}<br />
}</code></p>
<p>nel caso in cui faccia parte dello stesso Assembly dello xaml per poterla utilizzare si deve aggiungere il riferimento al Namespace</p>
<p><img class="size-full wp-image-57" style="vertical-align:baseline;" src="http://th3nu11.files.wordpress.com/2008/04/selectns3.jpg?w=510" alt="" /></a></p>
<p>(<em>local </em>è il prefisso per il mapping del namespace <em>PlayWithXMLNS.Oject.Item </em>che ci permetterà di accedere alle classi).</p>
<p>A questo punto possiamo utilizzare la nostra classe:</p>
<p><img class="size-full wp-image-40" style="vertical-align:baseline;" src="http://th3nu11.files.wordpress.com/2008/04/resource.jpg?w=510" alt=""   /></a></p>
<p>e associarla a qualche controllo</p>
<p><img class="size-full wp-image-43" style="vertical-align:baseline;" src="http://th3nu11.files.wordpress.com/2008/04/simpleresourcebind.jpg?w=510" alt=""   /></a></p>
<p>Se si vuole invece far riferimento a un namespace di una dll esterna è necessario definire anche l&#8217;assembly (in questo caso l&#8217;assembly esterno si chiama <em>EXTClass</em>).</p>
<p><img class="size-full wp-image-52" style="vertical-align:baseline;" src="http://th3nu11.files.wordpress.com/2008/04/nsext2.jpg?w=510" alt=""   /></a></p>
<p><img class="size-full wp-image-53" style="vertical-align:baseline;" src="http://th3nu11.files.wordpress.com/2008/04/resource2.jpg?w=510" alt=""   /></a></p>
<p>Così facendo però leghiamo il XAML anche al nome dell&#8217;assembly oltre che al namespace: per evitarlo, l&#8217;assembly esterno deve definire l&#8217;attributo <em>System.Windows.Markup.XmlnsDefinition</em> che permette di associare un xmlNameSpace al nostro clrNamespace.</p>
<p><code>[assembly: XmlnsDefinition("MyExtClass", "EXTClass.Object.Item")]</code></p>
<p>Così ora per far riferimento al namespace <em>EXTClass.Object.Item </em>dell&#8217;assembly esterno <em>EXTClass </em> è sufficiente:</p>
<p><img class="size-full wp-image-54" style="vertical-align:baseline;" src="http://th3nu11.files.wordpress.com/2008/04/ns3.jpg?w=510" alt=""   /></a></p>
<p><strong>Da notare però che questo attributo funziona solo tra assembly diversi per via dell&#8217;ordine di compilazione degli elementi come spiegato <a href="http://www.removingalldoubt.com/default.aspx?date=2006-11-01T00:00:00">qui.</a></strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/th3nu11.wordpress.com/36/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/th3nu11.wordpress.com/36/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/th3nu11.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/th3nu11.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/th3nu11.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/th3nu11.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/th3nu11.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/th3nu11.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/th3nu11.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/th3nu11.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/th3nu11.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/th3nu11.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/th3nu11.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/th3nu11.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/th3nu11.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/th3nu11.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=36&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://th3nu11.wordpress.com/2008/04/23/xmlns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/32fae2dfba6cacd3bfe85c8826a33377?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">th3nu11</media:title>
		</media:content>

		<media:content url="http://th3nu11.files.wordpress.com/2008/04/selectns3.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/04/resource.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/04/simpleresourcebind.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/04/nsext2.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/04/resource2.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/04/ns3.jpg" medium="image" />
	</item>
		<item>
		<title>String to Array and Array to String</title>
		<link>http://th3nu11.wordpress.com/2008/03/27/string-to-array-and-array-to-string/</link>
		<comments>http://th3nu11.wordpress.com/2008/03/27/string-to-array-and-array-to-string/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 12:01:56 +0000</pubDate>
		<dc:creator>th3nu11</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[Join]]></category>
		<category><![CDATA[Split]]></category>
		<category><![CDATA[String]]></category>

		<guid isPermaLink="false">http://th3nu11.wordpress.com/?p=32</guid>
		<description><![CDATA[Una cosa che uso spesso è il metodo statico Split della classe String; questo permette di suddivide una stringa in base al/ai delimitatore/i passatogli. Oltre al/ai carattere/i separatore/i gli si può passare il parametro RemoveEmptyEntries (StringSplitOption) che causa l&#8217;eliminazione di tutti gli elementi &#8220;vuoti&#8221;. string myList = "pippo,paperino,,pluto,franco"; string[] mySplittedList; mySplittedList = myList.Split( new char[]{','}, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=32&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Una cosa che uso spesso è il metodo statico <a href="http://msdn2.microsoft.com/it-it/library/system.string.split(VS.80).aspx">Split</a> della classe <a href="http://msdn2.microsoft.com/it-it/library/system.string(VS.80).aspx">String</a>; questo permette di suddivide una stringa in base al/ai delimitatore/i passatogli.</p>
<p>Oltre al/ai carattere/i separatore/i gli si può passare il parametro <i>RemoveEmptyEntries</i> (<a href="http://msdn2.microsoft.com/en-us/library/system.stringsplitoptions.aspx">StringSplitOption</a>)  che causa l&#8217;eliminazione di tutti gli elementi &#8220;vuoti&#8221;.<br />
<code>string myList = "pippo,paperino,,pluto,franco";<br />
string[] mySplittedList;<br />
mySplittedList = myList.Split(<br />
new char[]{','},<br />
StringSplitOptions.RemoveEmptyEntries );<br />
</code></p>
<p>Ottenendo il risultato:</p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/stringsplit.jpeg?w=424&#038;h=90" height="90" width="424" /></p>
<p>Quello che fino ad oggi non sapevo è che c&#8217;è anche un metodo che si occupa di ri-costruire la stringa partendo da un array <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Questo è il metodo statico <a href="http://msdn2.microsoft.com/en-us/library/tk0xe5h0.aspx">Join</a> della classe <a href="http://msdn2.microsoft.com/it-it/library/system.string(VS.80).aspx">String</a>.</p>
<p><code>string newList = String.Join(",", mySplittedList);</code></p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/stringjoin.jpeg?w=510" /></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/th3nu11.wordpress.com/32/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/th3nu11.wordpress.com/32/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/th3nu11.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/th3nu11.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/th3nu11.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/th3nu11.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/th3nu11.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/th3nu11.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/th3nu11.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/th3nu11.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/th3nu11.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/th3nu11.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/th3nu11.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/th3nu11.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/th3nu11.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/th3nu11.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=32&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://th3nu11.wordpress.com/2008/03/27/string-to-array-and-array-to-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/32fae2dfba6cacd3bfe85c8826a33377?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">th3nu11</media:title>
		</media:content>

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/stringsplit.jpeg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/stringjoin.jpeg" medium="image" />
	</item>
		<item>
		<title>Riflesso</title>
		<link>http://th3nu11.wordpress.com/2008/03/20/riflesso/</link>
		<comments>http://th3nu11.wordpress.com/2008/03/20/riflesso/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 16:53:09 +0000</pubDate>
		<dc:creator>th3nu11</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[Background]]></category>
		<category><![CDATA[Reflect]]></category>
		<category><![CDATA[Reflection]]></category>
		<category><![CDATA[RenderTransform]]></category>
		<category><![CDATA[VisualBrush]]></category>
		<category><![CDATA[xaml]]></category>

		<guid isPermaLink="false">http://th3nu11.wordpress.com/?p=28</guid>
		<description><![CDATA[Una cosa molto bella esteticamente è il riflesso e grazie allo xaml è anche molto semplice da implementare! Creiamo un&#8217;applicazione WPF e dividiamo la Grid base della window principale in due righe di uguale altezza: nella prima riga metteremo il contenuto(una grid nominata myContainer) della nostra finestra (liste, bottoni e chi più ne ha ne [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=28&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p> Una cosa molto bella esteticamente è il riflesso e grazie allo xaml è anche molto semplice da implementare!</p>
<p>Creiamo un&#8217;applicazione WPF e dividiamo la Grid base della window principale in due righe di uguale altezza: <i></i></p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/reflect_gridrows2.jpg?w=553&#038;h=188" height="188" width="553" /></p>
<p>nella prima riga metteremo il contenuto(una grid nominata <i>myContainer</i>) della nostra finestra (liste, bottoni e chi più ne ha ne metta) mentre nella seconda riga metteremo il pannello(<i>myReflector</i>) che riflette il contenuto di <i>myContainer .</i></p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/reflect_allcontent.jpg?w=232&#038;h=125" height="125" width="232" /></p>
<p>Ora aggiungiamo dei controlli a myContainer (una lista sulla sinistra e a destra una textbox e un bottone che aggiunge il testo della textbox nella lista) .</p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/reflect_mycontainer.jpg?w=332&#038;h=375" height="375" width="332" /></p>
<p>Ci aggiungiamo il codice per gli l&#8217;aggiunta del testo.<br />
<code>private void btnInsert_Click<br />
(object sender, RoutedEventArgs e)<br />
{<br />
if (txtInsert.Text.Trim() != "")<br />
{<br />
lstBox.Items.Add(txtInsert.Text.Trim());<br />
}<br />
}<br />
</code></p>
<p>ottenendo così questo risultato</p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/reflect_win1.jpg?w=302&#038;h=302" height="302" width="302" /></p>
<p>Ora non ci resta che far riflettere al pannello sotto (<i>myReflector</i>) il contenuto della griglia superiore(<i>myContainer</i>).</p>
<p>Per fare questo lo xaml mette a disposizione Il <a href="http://msdn2.microsoft.com/en-us/library/system.windows.media.visualbrush.aspx"><i>VisualBrush</i></a>.<br />
Questo controllo può essere utilizzato per visualizzare i suoi componenti figli in modo visuale (ma in tal caso questi perdono tutte le loro funzionalità) oppure per creare un&#8217;immagine dell&#8217;oggetto visual di destinazione (ovvero quello che vogliamo noi).</p>
<p>Quindi aggiungiamo come background del <i>myReflector</i> un <i>visualBrush</i> che punta al nostro <i>myContainer</i>.</p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/reflect_reflectxaml.jpg?w=318&#038;h=143" height="143" width="318" /></p>
<p>ottenendo</p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/reflect_reflectwin.jpg?w=302&#038;h=303" height="303" width="302" /></p>
<p><i>MyReflector</i> verrà aggiornato ad ogni modifica ottenendo così un riflesso in realtime. Essendo la copia dell&#8217;immagine fatta &#8220;pixel per pixel&#8221; il numero di controlli contenuti in <i>myContainer</i> non va a influire sulle prestazioni del <i>VisualBrush</i> (ovvero se ci sono 2 o 3 o n controlli.. <i>visualbrush</i> richiede sempre le stesse risorse <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  )</p>
<p>Per concludere non ci resta che capovolgere il riflesso e sfumarlo <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>La rotazione si ottiene con:<br />
<code>ScaleTransform  ScaleX="1" ScaleY="-1"</code><br />
mentre con<br />
<code>RenderTransformOrigin="0.5, 0.5"</code><br />
si imposta il di origine su cui viene calcolata la rotazione in modo che il pannello <i>myReflector </i> rimanga nella sua posizione originale invece che spostarsi a causa della rotazione.</p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/reflect_transform.jpg?w=510" /></p>
<p>Mentre la sfumatura (con la trasparenza che va in aumentando ) la si ottiene settando un LinearBrush come <i>opacitymask  </i> del <i>myReflector</i>.</p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/reflect_opacitymask.jpg?w=510" /></p>
<p>Riassumendo <i>myReflector </i>sarà così:</p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/reflect_allreflector.jpg?w=510" /></p>
<p>e questo il risultato finale:</p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/reflect_finalwin4.jpg?w=510" /></p>
<p>Una cosa da notare è che il <i>VisualBrush</i> sposta l&#8217;immagine che visualizza in alto a sinistra. Il modo più semplice per risolvere il problema è impostare uno sfondo praticamente invisibile (<i>background </i>con visibilità 1%) del <i>myContainer</i>. In questo modo si evitano problemi inutili riguardo al posizionamento del riflesso. <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />   (Nel nostro caso questo problema non si pone perchè i controlli coprono completamente l&#8217;area).</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/th3nu11.wordpress.com/28/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/th3nu11.wordpress.com/28/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/th3nu11.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/th3nu11.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/th3nu11.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/th3nu11.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/th3nu11.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/th3nu11.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/th3nu11.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/th3nu11.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/th3nu11.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/th3nu11.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/th3nu11.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/th3nu11.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/th3nu11.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/th3nu11.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=28&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://th3nu11.wordpress.com/2008/03/20/riflesso/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/32fae2dfba6cacd3bfe85c8826a33377?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">th3nu11</media:title>
		</media:content>

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/reflect_gridrows2.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/reflect_allcontent.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/reflect_mycontainer.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/reflect_win1.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/reflect_reflectxaml.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/reflect_reflectwin.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/reflect_transform.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/reflect_opacitymask.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/reflect_allreflector.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/reflect_finalwin4.jpg" medium="image" />
	</item>
		<item>
		<title>Attributi Enum</title>
		<link>http://th3nu11.wordpress.com/2008/03/18/attributi-enum/</link>
		<comments>http://th3nu11.wordpress.com/2008/03/18/attributi-enum/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 09:54:00 +0000</pubDate>
		<dc:creator>th3nu11</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Attribute]]></category>
		<category><![CDATA[Enum]]></category>
		<category><![CDATA[Reflection]]></category>

		<guid isPermaLink="false">http://th3nu11.wordpress.com/?p=12</guid>
		<description><![CDATA[A volte mi capita di aver bisogno di associare ulteriori valori ad ogni elemento di un enum, quale cosa migliore che utilizzare la reflection Partiamo da un semplice enum public enum eMyEnum { Val0=0, Val1=1, Val2=2 } Supponiamo ora di volere associare ad ogni elemento di questo enum una descrizione e un colore. Creiamo una [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=12&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A volte mi capita di aver bisogno di associare ulteriori valori ad ogni elemento di un enum, quale cosa migliore che utilizzare la reflection <img src="http://th3nu11.files.wordpress.com/2008/03/_d.jpg?w=23&#038;h=23" height="23" width="23" /></p>
<p>Partiamo da un semplice enum</p>
<p><code>public enum eMyEnum<br />
{<br />
Val0=0,<br />
Val1=1,<br />
Val2=2<br />
}</code></p>
<p>Supponiamo ora di volere associare ad ogni elemento di questo enum una descrizione e un colore.<br />
Creiamo una classe che estende l&#8217;interfaccia <i>System.Attribute</i> e che contiene tutti i valori che vogliamo associare agli elementi del enum.</p>
<p><code>public class MyAttribute : System.Attribute<br />
{<br />
public MyAttribute(string description, string color)<br />
{<br />
_description=description;<br />
_color = color;<br />
}<br />
private string _description;<br />
public string Description<br />
{<br />
get { return _description; }<br />
set { _description = value; }<br />
}<br />
private string _color;<br />
public string Color<br />
{<br />
get { return _color; }<br />
set { _color = value; }<br />
}<br />
}</code></p>
<p>Ora dobbiamo aggiungere gli attributi agli elementi del nostro enum.</p>
<p><code>public enum eMyEnum<br />
{<br />
[MyAttribute ("Questo è il valore 0","#FFAAFF")]<br />
Val0=0,<br />
[MyAttribute("Questo è il valore 1", "#FFAAAA")]<br />
Val1=1,<br />
[MyAttribute("Questo è il valore 2", "#AAAAAA")]<br />
Val2=2<br />
}</code></p>
<p>In questo modo ad ogni elemento dell&#8217;enum è associata un&#8217;istanza della classe <i>MyAttribute</i> contenente dei valori; non ci resta che recuperare questa istanza:</p>
<p>Importiamo prima di tutto il namespace <i>System.Reflaction</i></p>
<p><code>using System.Reflection;</code></p>
<p>..e successivamente implementiamo il metodo che recupera gli attributi</p>
<p><code>public static MyAttribute GetAttribute(eMyEnum value)<br />
{<br />
try<br />
{<br />
Type t = typeof(eMyEnum);<br />
FieldInfo fi = t.GetField(value.ToString());<br />
MyAttribute[] att =<br />
(MyAttribute[])fi.GetCustomAttributes(<br />
typeof(MyAttribute),<br />
false);<br />
if (att.Length &gt; 0)<br />
{<br />
return att[0];<br />
}<br />
else<br />
{<br />
return null;<br />
}<br />
}<br />
catch (Exception ex)<br />
{<br />
return null;<br />
}<br />
}</code></p>
<p>Grazie alla reflection è possibile andare a recuperare tutti gli attributi associati alle property,campi ecc di un tipo. In questo caso mi faccio restituire tutti gli attributi del tipo <i>MyAttribute</i> e prendo il primo della lista (se c&#8217;è, altrimenti restituisco <i>null</i>)</p>
<p>Non ci resta che verificare che il tutto funzioni</p>
<p><code>public void Test()<br />
{<br />
eMyEnum myEnum = eMyEnum.Val1;<br />
MyAttribute att = MyAttribute.GetAttribute(myEnum);<br />
if (att != null)<br />
{<br />
MessageBox.Show(att.Description + " [ Color=" + att.Color + "];");<br />
}<br />
}<br />
</code></p>
<p>Ed ecco il risultato</p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/msgbox_enumwithattribute.jpg?w=225&#038;h=112" height="112" width="225" /></p>
<p>Quanto mi piace la reflection!! <img src="http://th3nu11.files.wordpress.com/2008/03/d.jpg?w=510" /></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/th3nu11.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/th3nu11.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/th3nu11.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/th3nu11.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/th3nu11.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/th3nu11.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/th3nu11.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/th3nu11.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/th3nu11.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/th3nu11.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/th3nu11.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/th3nu11.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/th3nu11.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/th3nu11.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/th3nu11.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/th3nu11.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=12&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://th3nu11.wordpress.com/2008/03/18/attributi-enum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/32fae2dfba6cacd3bfe85c8826a33377?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">th3nu11</media:title>
		</media:content>

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/_d.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/msgbox_enumwithattribute.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/d.jpg" medium="image" />
	</item>
		<item>
		<title>Routing eventi</title>
		<link>http://th3nu11.wordpress.com/2008/03/17/routing-eventi/</link>
		<comments>http://th3nu11.wordpress.com/2008/03/17/routing-eventi/#comments</comments>
		<pubDate>Mon, 17 Mar 2008 13:45:01 +0000</pubDate>
		<dc:creator>th3nu11</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[handled]]></category>
		<category><![CDATA[Routing]]></category>
		<category><![CDATA[xaml]]></category>

		<guid isPermaLink="false">http://th3nu11.wordpress.com/?p=3</guid>
		<description><![CDATA[Giocando con le griglie sono incappato in un problemino: date due griglie innestate non volevo che la griglia padre ricevesse gli eventi della griglia figlia. Quindi partendo da questo XAML associato a questo codice per la gestione degli eventi private void grdBlue_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { MessageBox.Show("Blue grid click"); } private void grdRed_MouseLeftButtonDown(object sender, MouseButtonEventArgs [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=3&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Giocando con le griglie sono incappato in un problemino:  date due griglie innestate non volevo che la griglia padre ricevesse gli eventi della griglia figlia.</p>
<p>Quindi partendo da questo XAML<br />
<code></code></p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/2grids.jpg?w=533&#038;h=106" height="106" width="533" /></p>
<p>associato a questo codice per la gestione degli eventi<br />
<code><br />
private void grdBlue_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)<br />
{<br />
MessageBox.Show("Blue grid click");<br />
}<br />
private void grdRed_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)<br />
{<br />
MessageBox.Show("Red grid click");<br />
}<br />
</code><br />
otteniamo che cliccando sul rettangolino rosso appare prima la messagebox con &#8220;Red grid click&#8221; e successivamente la messagebox con &#8220;Blue grid click&#8221;.</p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/screenjot-cropped-03-17-2008-13-11-23.jpeg?w=510" /></p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/screenjot-cropped-03-17-2008-13-11-31.jpeg?w=510" /></p>
<p>per evitare che scatti anche l&#8217;evento sulla grdBlue è sufficiente settare come gestite l&#8217;evento<br />
<code><br />
private void grdRed_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)<br />
{<br />
MessageBox.Show("Red grid click");<br />
e.Handled = true;<br />
}<br />
</code><br />
In questo modo il routing dell&#8217;evento si fermerà alla grdRed.<br />
(In realtà è sufficiente sottoscriversi ad un evento tramite il metodo <i>void UIElement.AddHandler(RoutedEvent routedEvent, Delegate handler, bool handledEventsToo)</i> passando <i>handledEventsToo</i> a true per intercettare mettodi già gestiti.<br />
<a href="http://msdn2.microsoft.com/it-it/library/ms598899.aspx">Metodo UIElement..::.AddHandler (RoutedEvent, Delegate, Boolean)</a><br />
)</p>
<p>Se invece volessimo ottenere l&#8217;opposto, ovvero che venga ignorata la grdRed quando viene cliccata ci basterebbe settare la proprietà <i>IsHitTestVisible=&#8221;False&#8221;</i> nello XAML.</p>
<p>Cliccando sulla griglia rossa ora verrà lanciato solo l&#8217;evento della griglia padre (ovvero il click sulla grdBlue).</p>
<p>Un&#8217;altra cosa che si può fare è utilizzare un gestore per un evento di tutti i figli sfruttando gli eventi indirizzati(Routed Events)<br />
<a href="http://msdn2.microsoft.com/it-it/library/ms742806.aspx">Cenni preliminari sugli eventi indirizzati</a></p>
<p>Supponiamo il caso di avere una griglia con n bottoni al suo interno e di voler utlizzare lo stesso handler per tutti i bottoni.</p>
<p><img src="http://th3nu11.files.wordpress.com/2008/03/buttons.jpg?w=566&#038;h=191" height="191" width="566" /></p>
<p>Una soluzione potrebbe essere quella di sottoscrivere l&#8217;evento click bottone per bottone all&#8217;handler scrivendo però parecchio codice in più.<br />
La soluzione migliore è quella di impostare il handler nel padre (nell&#8217;esempio sopra<i> ButtonBase.Click=&#8221;grdBlue_btnClick&#8221;</i>), in questo modo tutti i suoi figli usufruiranno di questa sottoscrizione.</p>
<p><code></code><br />
<code><br />
private void grdBlue_btnClick(object sender, RoutedEventArgs e)<br />
{<br />
Button btn = (Button)e.OriginalSource ;<br />
MessageBox.Show("Blue grid click: " + btn.Name);<br />
}<br />
</code><br />
Il sender dell&#8217;evento sarà la griglia che ha definito l&#8217;handler; mentre il button che ha lanciato l&#8217;evento è memorizzato in <i>e.OriginalSource</i>.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/th3nu11.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/th3nu11.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/th3nu11.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/th3nu11.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/th3nu11.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/th3nu11.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/th3nu11.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/th3nu11.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/th3nu11.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/th3nu11.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/th3nu11.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/th3nu11.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/th3nu11.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/th3nu11.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/th3nu11.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/th3nu11.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=3&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://th3nu11.wordpress.com/2008/03/17/routing-eventi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/32fae2dfba6cacd3bfe85c8826a33377?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">th3nu11</media:title>
		</media:content>

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/2grids.jpg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/screenjot-cropped-03-17-2008-13-11-23.jpeg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/screenjot-cropped-03-17-2008-13-11-31.jpeg" medium="image" />

		<media:content url="http://th3nu11.files.wordpress.com/2008/03/buttons.jpg" medium="image" />
	</item>
		<item>
		<title>Hello world!</title>
		<link>http://th3nu11.wordpress.com/2008/03/17/hello-world/</link>
		<comments>http://th3nu11.wordpress.com/2008/03/17/hello-world/#comments</comments>
		<pubDate>Mon, 17 Mar 2008 10:47:54 +0000</pubDate>
		<dc:creator>th3nu11</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=1&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Welcome to <a href="http://wordpress.com/">WordPress.com</a>. This is your first post. Edit or delete it and start blogging!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/th3nu11.wordpress.com/1/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/th3nu11.wordpress.com/1/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/th3nu11.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/th3nu11.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/th3nu11.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/th3nu11.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/th3nu11.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/th3nu11.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/th3nu11.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/th3nu11.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/th3nu11.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/th3nu11.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/th3nu11.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/th3nu11.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/th3nu11.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/th3nu11.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=th3nu11.wordpress.com&amp;blog=3187137&amp;post=1&amp;subd=th3nu11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://th3nu11.wordpress.com/2008/03/17/hello-world/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/32fae2dfba6cacd3bfe85c8826a33377?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">th3nu11</media:title>
		</media:content>
	</item>
	</channel>
</rss>
