<?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/"
	>

<channel>
	<title>Matias Bonaventura</title>
	<atom:link href="http://blogs.southworks.net/matiasb/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.southworks.net/matiasb</link>
	<description></description>
	<lastBuildDate>Wed, 17 Nov 2010 16:15:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Prism Training Kit: Updated to Prism 4.0</title>
		<link>http://blogs.southworks.net/matiasb/2010/11/16/prism-training-kit-updated-to-prism-4-0/</link>
		<comments>http://blogs.southworks.net/matiasb/2010/11/16/prism-training-kit-updated-to-prism-4-0/#comments</comments>
		<pubDate>Tue, 16 Nov 2010 19:34:50 +0000</pubDate>
		<dc:creator>Matias Bonaventura</dc:creator>
				<category><![CDATA[Composite Application Guidance]]></category>
		<category><![CDATA[Emerging Technologies]]></category>
		<category><![CDATA[Guidance]]></category>
		<category><![CDATA[Patterns and Practices]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[prism 4.0]]></category>
		<category><![CDATA[training kit]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/matiasb/2010/11/16/prism-training-kit-updated-to-prism-4-0/</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/matiasb/2010/11/16/prism-training-kit-updated-to-prism-4-0/" class="more-link">read more<img src="http://blogs.southworks.net/matiasb/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>Are you new to Prism? Do you want to learn about the new features of Prism 4? Or are you searching for Prism training resources? If you are, this post is for you…</p>
<p>Fast Download links : <a href="http://prismtk.codeplex.com/releases/55821/download/167872">Prism Training Kit 1.1</a> | <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=3453ab2b-2067-41e4-b087-312d8385cf1b&amp;displaylang=en">Prism 4</a></p>
<p>A <a href="http://karlshifflett.wordpress.com/2010/11/12/prism-4-0-for-visual-studio-2010-net-framework-4-0-wpf-silverlight-4/">new version of Prism</a> (aka Composite Application Guidance for WPF and Silverlight) has been officially released last week, and the community has been very enthusiastic about it.&#160; You can read more about this on <a href="http://blogs.southworks.net/dpoza/2010/11/15/prism-4-0-released/">Diego’s blog</a> and <a href="http://blogs.msdn.com/b/kashiffl/archive/2010/11/12/prism-4-0-for-visual-studio-2010-net-framework-4-0-wpf-amp-silverlight-4.aspx">Karl&#8217;s blog</a>.</p>
<p>With <a href="http://blogs.southworks.net/dschenkelman/">Damian</a>, <a href="http://blogs.southworks.net/dpoza/">Diego</a>, <a href="http://blogs.southworks.net/gmaliandi/">Guido</a> and&#160; <a href="http://blogs.southworks.net/ejadib/">Ezequiel</a> we have updated the <a href="http://prismtk.codeplex.com/">Prism Training Kit</a> (now it’s version 1.1 <img src='http://blogs.southworks.net/matiasb/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ) to target the new bits of Prism 4. The Beta Training Kit includes 5 Hands-On-Labs that cover some of Prism&#8217;s core concepts (<a href="http://msdn.microsoft.com/en-us/library/gg405479%28PandP.40%29.aspx">modularity</a>, <a href="http://msdn.microsoft.com/en-us/library/gg430868%28PandP.40%29.aspx">bootstrapping</a>, <a href="http://msdn.microsoft.com/en-us/library/ff921140%28PandP.40%29.aspx">dependency injection</a>, <a href="http://msdn.microsoft.com/en-us/library/ff921098%28PandP.40%29.aspx">UIComposition</a> and <a href="http://msdn.microsoft.com/en-us/library/ff921122%28PandP.40%29.aspx">Communication</a>), which are now using Prism 4 assemblies. We also take the oportunity to solve the all the bugs that were reported. If you want to know more about prism training kit content you can read <a href="http://blogs.southworks.net/dschenkelman/2010/07/02/prism-training-kit-beta-version-available/">Prism Training Kit: Beta Version Available</a>.</p>
<p>Additionally, as we had received very good feedback from the community about the training kit (which has 1000+ downloads <img src='http://blogs.southworks.net/matiasb/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ), this week we plan to add new content to the training kit tackling the new concepts introduced in Prism 4. We have in mind adding the following new labs:</p>
<ul>
<li>Using Managed Extensibility Framework (MEF) with Prism Applications. </li>
<li>Prism Navigation Framework. </li>
<li>Prism 4 Windows Phone 7 </li>
</ul>
<p>(We intentionally left MVVM out, as there are already very good samples in <a href="http://karlshifflett.wordpress.com/2010/11/07/in-the-box-ndash-mvvm-training/">Karl’s in-the-box MVVM training</a>).</p>
<p>If you feel we are missing something important please let us know <img src='http://blogs.southworks.net/matiasb/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Your feedback is really appreciated!</p>
<p><a href="http://blogs.southworks.net/matiasb/files/2010/11/image.png"><img style="border-right-width: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" border="0" alt="image" src="http://blogs.southworks.net/matiasb/files/2010/11/image_thumb.png" width="485" height="484" /></a></p>
<p>Hope you find it useful!</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeCamp Buenos Aires:  Patrones de Presentaci&#243;n en WPF y Silverlight</title>
		<link>http://blogs.southworks.net/matiasb/2010/09/07/codecamp-buenos-aires-patrones-de-presentacin-en-wpf-y-silverlight/</link>
		<comments>http://blogs.southworks.net/matiasb/2010/09/07/codecamp-buenos-aires-patrones-de-presentacin-en-wpf-y-silverlight/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 18:34:50 +0000</pubDate>
		<dc:creator>Matias Bonaventura</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/matiasb/?p=61</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/matiasb/2010/09/07/codecamp-buenos-aires-patrones-de-presentacin-en-wpf-y-silverlight/" class="more-link">read more<img src="http://blogs.southworks.net/matiasb/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>Durante el fin de semana, presentamos en el <a href="http://www.codecamp.com.ar">CodeCamp 2010</a> junto a <a href="http://blogs.southworks.net/dschenkelman/">Damian Schenkelman</a> y <a href="http://blogs.southworks.net/dpoza/">Diego Poza</a> sobre <a href="http://www.codecamp.com.ar/patrones-de-presentacion-en-wpf4-y-silverlight-4.aspx">Patrones de Presentación en WPF y Silverlight</a>, específicamente MVVM. </p>
<p>Quería agradecerle a todos los valientes que se despertaron el Sábado temprano para asistir a la charla y a todos los que organizaron el evento que salió fantástico!    <br />Para los que estuvieron en la charla y todavía no lo hicieron, por favor no se olviden de completar la encuesta en <a href="http://www.codecamp.com.ar:8080/feedback/">http://www.codecamp.com.ar:8080/feedback/</a>.</p>
<p><a href="http://blogs.southworks.net/matiasb/files/2010/09/image.png"><img border="0" alt="image" src="http://blogs.southworks.net/matiasb/files/2010/09/image-thumb.png" width="492" height="334" /></a> </p>
<p>En la charla nos centramos en el patrón <a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx">MVVM</a>, específicamente orientado para aplicaciones Silverlight y WPF, ya que utiliza fuertemente conceptos como <a href="http://msdn.microsoft.com/en-us/library/ms752347.aspx">Data Binding</a>, <a href="http://msdn.microsoft.com/en-us/library/ms752308.aspx">Commands</a> y <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged(v=VS.95).aspx">Notificaciones</a>. También mostramos otros patrones usados para desacoplar los diferentes conceptos dentro de la capa de presentación como <a href="http://msdn.microsoft.com/en-us/library/ff649643.aspx">MVC</a> y <a href="http://msdn.microsoft.com/en-us/magazine/cc188690.aspx">MVP</a>.</p>
<p>Realizamos una Demo con una aplicación de ejemplo, implementada sin utilizar ningún patrón, y luego la refactoreamos paso a paso para que utilice MVVM.</p>
<p><a href="http://blogs.southworks.net/matiasb/files/2010/09/image1.png"><img border="0" alt="image" src="http://blogs.southworks.net/matiasb/files/2010/09/image-thumb1.png" width="643" height="484" /></a> </p>
<p>Como prometimos, pueden bajarse las slides y el código de los siguientes links:</p>
<ul>
<li><a href="http://cid-4a672419bcb027be.office.live.com/self.aspx/CodeCamp2010/Patrones%20de%20presentacion%20en%20WPF4%20y%20SL4.pdf">Slides</a></li>
<li><a href="http://cid-4a672419bcb027be.office.live.com/self.aspx/CodeCamp2010/AppFinal.zip">MVVM demo</a></li>
</ul>
<p>Muchos preguntaron también por los frameworks que dan soporte para MVVM. Para eso les recomiendo que miren el <a href="http://www.japf.fr/silverlight/mvvm/">MVVM Frameworks explorer</a>, que tiene una lista bastante buena y actualizada.</p>
</p>
<p><a title="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged(v=VS.95).aspx" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged(v=VS.95).aspx">&#160;</a></p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prism 4.0 First Drop &#8211; MVVM</title>
		<link>http://blogs.southworks.net/matiasb/2010/06/03/prism-40-first-drop-mvvm/</link>
		<comments>http://blogs.southworks.net/matiasb/2010/06/03/prism-40-first-drop-mvvm/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 22:14:59 +0000</pubDate>
		<dc:creator>Matias Bonaventura</dc:creator>
				<category><![CDATA[Composite Application Guidance]]></category>
		<category><![CDATA[Patterns and Practices]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[prism 4.0]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/matiasb/?p=56</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/matiasb/2010/06/03/prism-40-first-drop-mvvm/" class="more-link">read more<img src="http://blogs.southworks.net/matiasb/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: small">The p&amp;p Team has just released the first drop of Prism 4.0 (previously known as the Composite Application Guidance for WPF and Silverlight). You can download this new version from the <a href="http://compositewpf.codeplex.com/releases/view/46407">codeplex site</a>.</span></p>
<h2>What’s new</h2>
<p><span style="font-size: small">In this first drop, you will find 2 new QuickStarts that tackles two of the main concerns of the community: MEF integration and the MVVM pattern.  In this post I’ll cover the MVVM QuickStarts and leave the MEF QuickStarts for the following post.</span></p>
<h3><span style="font-size: small"><strong>Basic Model-View-ViewModel Quickstart</strong></span></h3>
<p><span style="font-size: small">The BasicMVVM QuickStarts address the most usual challenges when developing MVVM triads. The QuickStarts demonstrate a POCO scenario,  showing a questionnaire with different question types that must be completed. By design, the QuickStarts targets Silverlight only (no WPF  version) and does not use any of the Prism library .</span></p>
<p><span style="font-size: small">(Styling is WIP <img src='http://blogs.southworks.net/matiasb/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> )</span></p>
<p><a href="http://blogs.southworks.net/matiasb/files/2010/06/clip-image001.jpg"><img src="http://blogs.southworks.net/matiasb/files/2010/06/clip-image001-thumb.jpg" border="0" alt="clip_image001" width="510" height="413" /></a></p>
<p><span style="font-size: small">Some of the challenges demonstrated in this quickstart are:</span></p>
<ul>
<li><strong><span style="font-size: small">INotifyPropertyChange implementation</span></strong></li>
</ul>
<blockquote><p><span style="font-size: small">Every ViewModel needs to notify the view when its bounded properties change. For that purpose, Silverlight provides the </span><a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx"><span style="font-size: small">INotifyPropertyChange</span></a><span style="font-size: small"> interface. The QuickStarts provides the ViewModelBase class, a base implementation that provides useful methods for property notification:</span></p></blockquote>
<ul>
<blockquote><p><span style="font-size: small"><span style="font-size: x-small">protected virtual void RaisePropertyChanged(string propertyName); <br />
protected void RaisePropertyChanged(params string[] propertyNames);<br />
protected void RaisePropertyChanged&lt;T&gt;(Expression&lt;Func&lt;T&gt;&gt; propertyExpresssion);</span>    </span></p></blockquote>
</ul>
<blockquote><p><span style="font-size: small">Besides the classic RaisePropertyChaged method that received the name of the property that has changed, it also provides an interesting overload that accepts a lambda expression, which allows to write property notification in the ViewModel as follows:</span></p></blockquote>
<ul>
<blockquote><p><span style="font-size: x-small">this.RaisePropertyChanged(() =&gt; this.Name);</span></p></blockquote>
<li><strong><span style="font-size: small">Validation</span></strong></li>
<p><span style="font-size: small">Another typical challenge is notifying the View when binding errors occur. For that reason, Silverlight provides two interfaces: </span><a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifydataerrorinfo%28VS.95%29.aspx"><span style="font-size: small">INotifyDataErrorInfo</span></a><span style="font-size: small"> and </span><a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.idataerrorinfo.aspx"><span style="font-size: small">IDataErrorInfo</span></a><span style="font-size: small">. The ViewModelBase class provides a base implementation for the INotifyDataErrorInfo that can be leveraged from the ViewModels: </span></p>
<blockquote><p><span style="font-size: x-small">public virtual bool HasErrors;<br />
public virtual IEnumerable GetErrors(string propertyName);<br />
protected void SetError(string propertyName, string error);<br />
protected void SetError&lt;T&gt;(Expression&lt;Func&lt;T&gt;&gt; propertyExpresssion, string error);<br />
protected void ClearErrors(string propertyName);<br />
protected void ClearErrors&lt;T&gt;(Expression&lt;Func&lt;T&gt;&gt; propertyExpresssion);<br />
protected void SetErrors(string propertyName, List&lt;string&gt; propertyErrors);<br />
protected void SetErrors&lt;T&gt;(Expression&lt;Func&lt;T&gt;&gt; propertyExpresssion, List&lt;string&gt; propertyErrors);<br />
protected virtual void RaiseErrorsChanged(string propertyName);<br />
protected virtual void RaiseErrorsChanged&lt;T&gt;(Expression&lt;Func&lt;T&gt;&gt; propertyExpresssion);</span></p></blockquote>
<p><span style="font-size: small">The quickstart demonstrate how the domain model validation is done on the Model (for example the NumericQuestions). Formatting validation is performed on the ViewModels (for example the Age property in the questionnaire) to customize error messages (if you don’t need customization of error messages you can just rely on Silverlight binding errors).</span></p>
<li><strong><span style="font-size: small">Transitions/Animations triggered by the ViewModel</span></strong></li>
</ul>
<blockquote><p><span style="font-size: small">Animations are typically triggered by the UI (e.g. when clicking a button). But some times animations must start based on a change in the ViewModel. The challenge in those cases is how to start the animation when the ViewModel doesn’t have a reference to the View. The quickstart demonstrate how to use Triggers and the VisualStateManager bound to a property in the ViewModel to accomplish that requirement:</span></p></blockquote>
<ul>
<blockquote>
<div id="a19ea85c-b0e3-4b40-ba59-0fbe4530e09d" class="wlWriterEditableSmartContent" style="padding-bottom: 0px;margin: 0px;padding-left: 0px;padding-right: 0px;float: none;padding-top: 0px">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="padding: 2px 5px"><span style="color: #0000ff">&lt;</span><span style="color: #a31515">i:Interaction.Triggers</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">    &lt;</span><span style="color: #a31515">ei:DataTrigger</span><span style="color: #0000ff"> </span><span style="color: #ff0000">Binding</span><span style="color: #0000ff">=</span>&#8220;{<span style="color: #0000ff">Binding CurrentState}</span>&#8220;<span style="color: #0000ff"> </span><span style="color: #ff0000">Value</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">Normal</span>&#8220;<span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">        &lt;</span><span style="color: #a31515">ei:GoToStateAction</span><span style="color: #0000ff"> </span><span style="color: #ff0000">StateName</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">Normal</span>&#8220;<span style="color: #0000ff">/&gt;</span><br />
<span style="color: #0000ff">    &lt;/</span><span style="color: #a31515">ei:DataTrigger</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">    &lt;</span><span style="color: #a31515">ei:DataTrigger</span><span style="color: #0000ff"> </span><span style="color: #ff0000">Binding</span><span style="color: #0000ff">=</span>&#8220;{<span style="color: #0000ff">Binding CurrentState}</span>&#8220;<span style="color: #0000ff"> </span><span style="color: #ff0000">Value</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">Submitting</span>&#8220;<span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">        &lt;</span><span style="color: #a31515">ei:GoToStateAction</span><span style="color: #0000ff"> </span><span style="color: #ff0000">StateName</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">Submitting</span>&#8220;<span style="color: #0000ff">/&gt;</span><br />
<span style="color: #0000ff">    &lt;/</span><span style="color: #a31515">ei:DataTrigger</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;/</span><span style="color: #a31515">i:Interaction.Triggers</span><span style="color: #0000ff">&gt;</span></div>
</div>
</div>
<p> </p></blockquote>
<li><strong><span style="font-size: small">Usage of hierarchical ViewModels (ViewModels that contain other ViewModels)</span></strong></li>
</ul>
<blockquote><p><span style="font-size: small">Each of the questions in the questionnaire has their own ViewModel, and the <strong>QuestionnaireViewModel</strong> has a property of type<strong> List&lt;QuestionViewModel&gt; Questions</strong>.  In the <strong>QuestionnaireView</strong>, the questions’ view models are bound  to the corresponding view DataTemplate. This is achieved by the newly developed  <strong>DataTemplateSelector</strong> (WPF provides a mechanisms for doing this out-of-the-box, Silverlight does not.)</span></p>
<div id="34ef388b-fa53-4268-8fac-93b4ee8eeba9" class="wlWriterEditableSmartContent" style="padding-bottom: 0px;margin: 0px;padding-left: 0px;padding-right: 0px;float: none;padding-top: 0px">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="padding: 2px 5px"><span style="color: #0000ff">&lt;</span><span style="color: #a31515">ItemsControl.ItemTemplate</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">    &lt;</span><span style="color: #a31515">DataTemplate</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">        &lt;</span><span style="color: #a31515">Infra:DataTemplateSelector</span><span style="color: #0000ff"> </span><span style="color: #ff0000">Content</span><span style="color: #0000ff">=</span>&#8220;{<span style="color: #0000ff">Binding}</span>&#8220;<span style="color: #0000ff"> </span><span style="color: #ff0000">HorizontalContentAlignment</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">Stretch</span>&#8220;<span style="color: #0000ff"> </span><span style="color: #ff0000">IsTabStop</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">False</span>&#8220;<span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">            &lt;</span><span style="color: #a31515">Infra:DataTemplateSelector.Resources</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">                &lt;</span><span style="color: #a31515">DataTemplate</span><span style="color: #0000ff"> </span><span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">OpenQuestionViewModel</span>&#8220;<span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">                    &lt;!&#8211;</span><span style="color: #008000"> View for OpenQuestionViewModel </span><span style="color: #0000ff">&#8211;&gt;</span><br />
<span style="color: #0000ff">                &lt;/</span><span style="color: #a31515">DataTemplate</span><span style="color: #0000ff">&gt;</span></div>
<p><span style="color: #0000ff">                &lt;</span><span style="color: #a31515">DataTemplate</span><span style="color: #0000ff"> </span><span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">MultipleSelectionQuestionViewModel</span>&#8220;<span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">                    &lt;!&#8211;</span><span style="color: #008000"> View for MultipleSelectionQuestionViewModel </span><span style="color: #0000ff">&#8211;&gt;</span><br />
<span style="color: #0000ff">                &lt;/</span><span style="color: #a31515">DataTemplate</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">                &lt;</span><span style="color: #a31515">DataTemplate</span><span style="color: #0000ff"> </span><span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">NumericQuestionViewModel</span>&#8220;<span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">                    &lt;!&#8211;</span><span style="color: #008000"> View for NumericQuestionViewModel </span><span style="color: #0000ff">&#8211;&gt;</span><br />
<span style="color: #0000ff">                &lt;/</span><span style="color: #a31515">DataTemplate</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">            &lt;/</span><span style="color: #a31515">Infra:DataTemplateSelector.Resources</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">        &lt;/</span><span style="color: #a31515">Infra:DataTemplateSelector</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">    &lt;/</span><span style="color: #a31515">DataTemplate</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;/</span><span style="color: #a31515">ItemsControl.ItemTemplate</span><span style="color: #0000ff">&gt;</span></p>
</div>
</div>
</blockquote>
<ul> </ul>
<ul>
<li><span style="font-size: small"><strong>Use of Blend Behaviors (Commanding, Data Template Selection, Binding, Validation) </strong></span></li>
</ul>
<blockquote><p><span style="font-size: small">Finally, the quickstart demonstrate the usage of several new Behaviors to simplify the binding between the View and the ViewModel.  Some of these behaviors are:</span></p>
<ul>
<li><span style="font-size: small"><strong>CallExecuteMethod</strong>: This behavior is similar to binding to a command, but removes the need to explicitly instantiate a Command in the ViewModel. You can specify the method to execute and a CanExecute property:</span></li>
</ul>
<p><span style="font-size: small">                       </span><span style="font-size: x-small">  &lt;Behaviors:CallExecuteMethodAction TargetObject=&#8221;{Binding}&#8221; ExecuteMethodName=&#8221;Submit&#8221; CanExecutePropertyName=&#8221;CanSubmit&#8221;/&gt;</span></p>
<ul>
<li><span style="font-size: small"><strong>UpdateTextBindingOnPropertyChanged: </strong>This behavior updates the binding every time the text property changes on a TextBox. This can be done in WPF without out-of-the-box behaviors , but is not available in Silverlight yet.</span></li>
<p>&lt;TextBox Text=&#8221;{Binding ResponseText, Mode=TwoWay, UpdateSourceTrigger=Explicit}&#8221;&gt;<br />
            &lt;i:Interaction.Behaviors&gt;<br />
                &lt;Behaviors:UpdateTextBindingOnPropertyChanged/&gt;<br />
            &lt;/i:Interaction.Behaviors&gt;<br />
&lt;/TextBox&gt;</p>
<li><span style="font-size: small"><strong>ValidateObject: </strong>This behavior updates the ValidationSummary property for the ValidationSummary controls whenever an error occurs on its source.</span></li>
</ul>
<p>         &lt;sdk:ValidationSummary &gt;<br />
            &lt;i:Interaction.Behaviors&gt;<br />
                &lt;Behaviors:ValidateObject SourceObject=&#8221;{Binding}&#8221;/&gt;<br />
            &lt;/i:Interaction.Behaviors&gt;<br />
        &lt;/sdk:ValidationSummary&gt;</p></blockquote>
<blockquote><p><span style="font-size: small">All these leverage Blend’s Behavior&lt;T&gt; class, so they can also be used with drag&amp;drop from Blend. </span></p></blockquote>
<p> </p>
<p><span style="font-size: small">This is the first drop of the new version of prism, so any feedback will be really appreciated from the p&amp;p team and will help improving future drops. Remember to leave your feedback in the <a href="http://compositewpf.codeplex.com/releases/view/46407">codeplex site</a>.</span></p>
<p><a rev="vote-for" href="http://dotnetshoutout.com/Prism-40-First-Drop-MVVM"><img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fblogs.southworks.net%2Fmatiasb%2F2010%2F06%2F03%2Fprism-40-first-drop-mvvm%2F"></a></p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Take the Prism 4.0 Survey</title>
		<link>http://blogs.southworks.net/matiasb/2010/04/28/take-the-prism-40-survey/</link>
		<comments>http://blogs.southworks.net/matiasb/2010/04/28/take-the-prism-40-survey/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 14:57:56 +0000</pubDate>
		<dc:creator>Matias Bonaventura</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/matiasb/?p=53</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/matiasb/2010/04/28/take-the-prism-40-survey/" class="more-link">read more<img src="http://blogs.southworks.net/matiasb/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.msdn.com/blaine/archive/2010/04/27/have-you-taken-the-prism-4-0-survey.aspx">Blaine Wastell</a> (Program Manager at pattern and practices) has just announced the <a href="http://www.zoomerang.com/Survey/WEB22AK39NFHMT">Prism 4.0 survey</a> is live.</p>
<p>Your feedback is needed to help prioritize the <a href="http://blogs.msdn.com/blaine/archive/2010/03/17/prism-4-0-plans.aspx">potential features of Prism</a> (previously called Composite Application Guidance for WPF and Silverlight) will include in its next version. Completing the survey should take you 5-10 minutes.</p>
<p><a href="http://blogs.southworks.net/matiasb/files/2010/04/image.png"><img style="float: none;margin-left: auto;margin-right: auto" border="0" alt="image" src="http://blogs.southworks.net/matiasb/files/2010/04/image-thumb.png" width="638" height="915" /></a></p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Prism Automation: Templates for implementing the MVVM pattern using the Composite Application Library</title>
		<link>http://blogs.southworks.net/matiasb/2009/08/15/prism-automation-templates-for-implementing-the-mvvm-pattern-using-the-composite-application-library/</link>
		<comments>http://blogs.southworks.net/matiasb/2009/08/15/prism-automation-templates-for-implementing-the-mvvm-pattern-using-the-composite-application-library/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 20:33:24 +0000</pubDate>
		<dc:creator>Matias Bonaventura</dc:creator>
				<category><![CDATA[Composite Application Guidance]]></category>
		<category><![CDATA[Patterns and Practices]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Prism-v2]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Automation]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/matiasb/?p=43</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/matiasb/2009/08/15/prism-automation-templates-for-implementing-the-mvvm-pattern-using-the-composite-application-library/" class="more-link">read more<img src="http://blogs.southworks.net/matiasb/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>With the help of <a href="http://blogs.southworks.net/dschenkelman/">Damian Schenkelman</a> and <a href="http://blogs.southworks.net/jdominguez/">Julian Dominguez</a>, we created some <a href="//blogs.southworks.net/matiasb/files/2009/08/prism-mvvm-templates1.zip">Visual Studio Item Templates </a>that provides the basic assets for implementing a new view using the MVVM pattern in <a href="http://msdn.microsoft.com/en-us/library/cc707819.aspx">Prism</a>. These templates create the necessary files and classes for the view and viewModel parts of the pattern.</p>
<p>I will explain in this post how to install and use the Prism MVVM templates. If you are not familiar with the MVVM pattern the following links are a good staring point:</p>
<ul>
<li><a href="http://compositewpf.codeplex.com/Wiki/View.aspx?title=Model%20View%20ViewModel%20%28MVVM%29">Model View ViewModel (MVVM)</a> in the <a href="http://compositewpf.codeplex.com/Wiki/View.aspx?title=Knowledge%20Base">prism Knowledge Base</a>.</li>
<li><a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx">WPF Apps With The Model-View-ViewModel Design Pattern</a></li>
<li><a href="http://msdn.microsoft.com/en-us/magazine/dd458800.aspx">Model-View-ViewModel In Silverlight 2 Apps</a></li>
<li><a href="http://blogs.msdn.com/dancre/archive/2006/07/23/676272.aspx">DataModel-View-ViewModel pattern: 1</a></li>
<li><a href="http://www.orbifold.net/default/?p=550">WPF patterns : MVC, MVP or MVVM or…?</a></li>
</ul>
<p>These MVVM templates aim to help you facilitate the creation of <a href="http://msdn.microsoft.com/en-us/library/dd490819.aspx">views with presenters</a> when developing prism applications. Then we disscuss briefly some implementation considetarions.<br />
<a href="http://blogs.msdn.com/dphill/">David Hill</a> has recently posted the <a href="http://blogs.msdn.com/dphill/archive/2009/06/15/prism-quick-start-kit-update.aspx">Prism Quick Start Kit</a> which includes project templates for creating prism <a href="http://msdn.microsoft.com/en-us/library/dd458929.aspx">Modules</a> and <a href="http://msdn.microsoft.com/en-us/library/dd458910.aspx">Shell</a>, both for WPF and Silverlight. <a href="http://blogs.southworks.net/dschenkelman/">Damian</a> has created <a href="http://blogs.southworks.net/dschenkelman/2009/08/13/c-code-snippet-to-create-commands-with-attached-behaviors-using-prism/">code snippets</a> for easing the creation of Commands with attached Behaviors.</p>
<h4>How-To: Install the Prism MVVM Templates</h4>
<p>Installing the templates it&#8217;s really simple!</p>
<ol>
<li><a href="//blogs.southworks.net/matiasb/files/2009/08/prism-mvvm-templates1.zip">Dowloand templates</a> and unzip them into your Visual Studio templates folder. They are C# templates so they go here on my system:<br />
    <strong>My Documents\Visual Studio 2008\Templates\ItemTemplates\Visual C#</strong></li>
<li>To avoid getting a warning message the first time you use them, you can close Visual Studio and run the following command (as admin) in a Visual Studio Command Prompt window:<br />
    <strong>devenv.exe /installvstemplates</strong></li>
</ol>
<p>That&#8217;s all! you should now be able see them in the New Items dialog.</p>
<h4>How-To: Use the Prism MVVM Templates</h4>
<p>Using the templates it&#8217;s also really simple (that&#8217;s the idea of using templates after all <img src='http://blogs.southworks.net/matiasb/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ).</p>
<ol>
<li>Open any prism application in Visual Studio. (Templates will work in any kind of application, but you will have to reference CAL assemblies).</li>
<li>Right click on the project/folder where you want to place your new view and select <strong>Add / New Item&#8230;</strong>The New Item Dialog will appear.</li>
<li>Select <strong>Prism MVVM</strong> or <strong>Prism MVVM (with interfaces)</strong> from the My Templates category.<a href="http://blogs.southworks.net/matiasb/files/2009/08/image3.png"><img src="http://blogs.southworks.net/matiasb/files/2009/08/image-thumb3.png" border="0" alt="image" width="644" height="392" /></a></li>
<li>Click <strong>Add.</strong>  This will create the View with xaml and code behind, and the ViewModel. If you selected <strong>Prism MVVM (with interfaces)</strong> template, it will additionally create interfaces for the View and ViewModel (this is highly recommended as it will ease testing).</li>
</ol>
<p><a href="http://blogs.southworks.net/matiasb/files/2009/08/image1.png"><img src="http://blogs.southworks.net/matiasb/files/2009/08/image-thumb1.png" border="0" alt="image" width="349" height="107" /></a></p>
<p>Great, we have now the new view with it&#8217;s corresponding ViewModel.  To show the view you should register it in the appropriate region as usual. For example, using view discovery (if you didn&#8217;t used interfaces, you won&#8217;t need the first line):</p>
<blockquote>
<pre><span style="color: #0000ff">this</span>._container.RegisterType&lt;<span style="color: #2b91af">ICustomersViewModel</span>, <span style="color: #2b91af">CustomersViewModel</span>&gt;();
<span style="color: #0000ff">this</span>._regionManager.RegisterViewWithRegion(RegionNames.ButtomLeftRegion, () =&gt; <span style="color: #0000ff">this</span>._container.Resolve&lt;<span style="color: #2b91af">CustomersView</span>&gt;());</pre>
</blockquote>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Using the above code in David&#8217;s Quickstart Solution, you can get the view shown:</p>
<p><a href="http://blogs.southworks.net/matiasb/files/2009/08/image4.png"><img src="http://blogs.southworks.net/matiasb/files/2009/08/image-thumb4.png" border="0" alt="image" width="352" height="239" /></a></p>
<h4>Implementation considerations:</h4>
<p>You will notice in the implementation of the view and viewModel that:</p>
<ol>
<li>View-First approach is used.</li>
<li>Templates can be used in WPF and Silverlight prism applications.</li>
<li>The implementation relies on prism, as it inyects the EA to the ViewModel.</li>
<li>A property is created in the viewModel, to demostrate databinding in the view.</li>
</ol>
<p>You can download the templates from <a href="//blogs.southworks.net/matiasb/files/2009/08/prism-mvvm-templates1.zip">here</a>.<br />
<a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.southworks.net%2fmatiasb%2f2009%2f08%2f15%2fprism-automation-templates-for-implementing-the-mvvm-pattern-using-the-composite-application-library%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.southworks.net%2fmatiasb%2f2009%2f08%2f15%2fprism-automation-templates-for-implementing-the-mvvm-pattern-using-the-composite-application-library%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automation Templates for the Composite Application Library: Prism Quick Start Kit</title>
		<link>http://blogs.southworks.net/matiasb/2009/08/06/automation-templates-for-the-composite-application-library-prism-quick-start-kit/</link>
		<comments>http://blogs.southworks.net/matiasb/2009/08/06/automation-templates-for-the-composite-application-library-prism-quick-start-kit/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 14:36:56 +0000</pubDate>
		<dc:creator>Matias Bonaventura</dc:creator>
				<category><![CDATA[Composite Application Guidance]]></category>
		<category><![CDATA[Patterns and Practices]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Prism-v2]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Automation]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/matiasb/2009/08/06/automation-templates-for-the-composite-application-library-prism-quick-start-kit/</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/matiasb/2009/08/06/automation-templates-for-the-composite-application-library-prism-quick-start-kit/" class="more-link">read more<img src="http://blogs.southworks.net/matiasb/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.msdn.com/dphill/">David Hill</a> (patterns and practices architect) has been working recently on new Visual Studio Templates that provide an excellent starting point for WPF and Silverlight Prism-v2 applications.  This is an experiment on how p&amp;p could provide some level of automation for next versions of prism, so don&#8217;t hesitate to post any comment on David&#8217;s <a href="http://blogs.msdn.com/dphill/archive/2009/06/15/prism-quick-start-kit-update.aspx">post</a>.</p>
<p>You can download and install these templates from David&#8217;s blog:</p>
<ul>
<li><a href="http://blogs.msdn.com/dphill/archive/2009/05/29/prism-quick-start-kit.aspx">Prism Quick Start Kit</a></li>
<li><a href="http://blogs.msdn.com/dphill/archive/2009/06/15/prism-quick-start-kit-update.aspx">Prism Quick Start Kit Update</a></li>
</ul>
<p>The <a href="http://msdn.microsoft.com/en-us/library/dd458809.aspx">Composite Application Guidance for WPF and Silverlight</a> (a.k.a Prism) provides several <a href="http://msdn.microsoft.com/en-us/library/dd458858.aspx">Quickstarts</a> that demonstrate key concepts of the library and the <a href="http://msdn.microsoft.com/en-us/library/dd458919.aspx">Stock Trader Reference Implementation</a> which illustrate a real-world scenario. The Prism Quick Start Kit aims to provide the basic structure for prism projects and solutions, easy to understand and make use of the recommended practices.</p>
<p>The Prism Quick Start Kit comes with quick-start solutions, templates for the Shell and module projects and supports both WPF and Silvelright.</p>
<p><img src="http://blogs.msdn.com/blogfiles/dphill/WindowsLiveWriter/PrismQuickStartKitUpdate_8735/image_2.png" alt="" /></p>
<p>Hope you find them useful!</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How-to Hide Views inside Composite Application Guidance (aka Prism-v2) regions.</title>
		<link>http://blogs.southworks.net/matiasb/2009/07/02/how-to-hide-views-inside-composite-application-guidance-aka-prism-v2-regions/</link>
		<comments>http://blogs.southworks.net/matiasb/2009/07/02/how-to-hide-views-inside-composite-application-guidance-aka-prism-v2-regions/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 15:21:25 +0000</pubDate>
		<dc:creator>Matias Bonaventura</dc:creator>
				<category><![CDATA[Composite Application Guidance]]></category>
		<category><![CDATA[Patterns and Practices]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Prism-v2]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/matiasb/?p=33</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/matiasb/2009/07/02/how-to-hide-views-inside-composite-application-guidance-aka-prism-v2-regions/" class="more-link">read more<img src="http://blogs.southworks.net/matiasb/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>The <strong>IRegion</strong> interface allows to Add/Remove and Activate/Deactivate the views contained in the region. These two sets of actions let us manipulate the state of each view in regions. While the meaning of Add/Remove is clear, the semantics of Activate/Deactivate might be confusing as it greatly depends on the concrete implementation of <strong>IRegion</strong>.</p>
<p><strong><span style="text-decoration: underline">Activate semantic by concrete region implementation (between brackets is the type of control attached to by default):</span></strong></p>
<ul>
<li><strong>SingleActiveRegion (ContentControl):</strong> There is a maximum of one active region at a time. This means that activating a view might trigger a deactivation of another view.<br />
If the region is created with the default adapter (<strong>ContentControlRegionAdapter</strong>) the active view will also be only one visible, as it is set as the content of the ContentControl.</li>
<li><strong>AllActiveRegion (ItemsControl):</strong> All views that are kept in the region are active. Calling Deactivate on a view will throw an InvalidOperationException. All views are usually visible.</li>
<li><strong>Region (Selector): </strong>This region allows for multiple active and deactive views.<br />
If created with the default adapter (<strong>SelectorRegionAdapter</strong>) the active views will be kept in sync with the SelectedItem/SelectedItems of the control. So when calling Activate on a view, you can only select a single active view at a time. By setting the SelectedItems property of a listbox, you can set multiple views to active. All views (active and deactive) are visible.</li>
</ul>
<p>The <strong>RegionActiveAwareBehavior </strong>and the <strong>IActiveAware</strong> interface are very close related to the activate semantic. So for example, even if the IActiveAware interface is implemented in a view, if it is contained in an <strong>AllActiveRegion</strong>, the view will only be notified of the active state change only once (when added to the region).</p>
<h2>Hiding views</h2>
<p>Activating and deactivating views is usually confused with it&#8217;s visibility. If you deactivate a view, it will only hide it if the region is a SingleActiveRegion. It will throw an exception in AllActiveRegions and it will not hide the view in Regions.</p>
<p>The posibility of hiding views while keeping the view in the region is not implemented out-of-the-box in prism-v2. Hiding view only makes sense in <strong>ItemsControl</strong> containers, as in other containers views are automatically hidden when they are not active. Hiding views might be particularly helpful, for example if there is a requirement to hide certain <strong>TabItems</strong> (as deactivating the view won&#8217;t hide the tab, and setting <strong>Visibility=Hidden</strong> in the view won&#8217;t hide the tab).</p>
<p>With Damian Schenkelman, we created the following two classes (one for Silverlight and one for WPF) that add extension methods to allow hide/show views in prism-v2 regions (Download links below). WPF methods implements hide/show for all <strong>ItemsControl </strong>containers while Silverlight methods are only implemented for the <strong>TabControl</strong>.</p>
<blockquote><p>· <strong>SilverlightRegionExtensions</strong> (allow hide views in <strong>TabControl</strong> regions)</p>
<p>· <strong>WPFRegionExtensions</strong> (allow hide views in <strong>ItemsControl</strong> regions)</p></blockquote>
<p>The aforementioned classes expose the following extension methods for the <strong>IRegion</strong> interface:</p>
<blockquote><p>· <strong>Hide(string viewName</strong>): Hides a view registered with a particular name in the region.</p>
<p>· <strong>Hide(object view):</strong> Hides the view passed as a parameter.</p>
<p>· <strong>Show(string viewName):</strong> Shows a view registered with a particular name in the region.</p>
<p>· <strong>Show(object view):</strong> Shows the view passed as a parameter.</p></blockquote>
<p>We also created a sample application to show it&#8217;s usage and to highlight the difference betwen Add/Remove, Activate/Deactivate, Hide/Show.<br />
<a href="http://blogs.southworks.net/matiasb/files/2009/07/image.png"><img src="http://blogs.southworks.net/matiasb/files/2009/07/image-thumb.png" border="0" alt="image" width="284" height="255" /></a></p>
<p>You can play with it selecting the tab checkboxes and pressing the action buttons.</p>
<p> </p>
<h2>Download</h2>
<p>We uploaded the WPF and silverlight region extension method to the <a href="http://compositewpf.codeplex.com/">Prism codeplex site</a>. You can get these classes from <a href="http://compositewpf.codeplex.com/">RegionExtensions.zip</a>.</p>
<p>You can also downloaded the sample application from <a href="http://blogs.southworks.net/matiasb/files/2009/07/hideviewssample.zip">Hide Views Sample</a> .<br />
<a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.southworks.net%2fmatiasb%2f2009%2f07%2f02%2fhow-to-hide-views-inside-composite-application-guidance-aka-prism-v2-regions%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.southworks.net%2fmatiasb%2f2009%2f07%2f02%2fhow-to-hide-views-inside-composite-application-guidance-aka-prism-v2-regions%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>How-to: Consume WCF services from Composite Application Guidance for WPF and Silverlight(Prism-v2) Modules</title>
		<link>http://blogs.southworks.net/matiasb/2009/06/20/how-to-consume-wcf-services-from-composite-application-guidance-for-wpf-and-silverlightprism-v2-modules/</link>
		<comments>http://blogs.southworks.net/matiasb/2009/06/20/how-to-consume-wcf-services-from-composite-application-guidance-for-wpf-and-silverlightprism-v2-modules/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 05:03:25 +0000</pubDate>
		<dc:creator>Matias Bonaventura</dc:creator>
				<category><![CDATA[Composite Application Guidance]]></category>
		<category><![CDATA[Patterns and Practices]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Prism-v2]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[WebBrowser Control]]></category>
		<category><![CDATA[WebBrowser]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/matiasb/?p=30</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/matiasb/2009/06/20/how-to-consume-wcf-services-from-composite-application-guidance-for-wpf-and-silverlightprism-v2-modules/" class="more-link">read more<img src="http://blogs.southworks.net/matiasb/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<div id="b203eda6-a1b2-40ad-91cb-386d527e99a6" class="wlWriterSmartContent" style="padding-right: 0px;padding-left: 0px;padding-bottom: 0px;margin: 0px;padding-top: 0px">Yesterday, while developing a <a href="http://blogs.southworks.net/dschenkelman/2009/06/23/webbrowser-control-quickstart-for-the-composite-application-guidance-for-wpf-and-silverlight-prism-v2/">demo app </a>that uses <a href="http://msdn.microsoft.com/en-us/library/dd458809.aspx">Prism-v2</a>, <a href="http://msdn.microsoft.com/en-us/library/ms735119.aspx">WCF services</a>, <a href="http://msdn.microsoft.com/en-us/asp.net/default.aspx">ASP.NET</a> web application and interaction with <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx">WebBrowser controls</a> ,  I run into a little problem trying to consume the service from a module.  I thought could be useful posting about it to save someone a little time.</div>
<div class="wlWriterSmartContent" style="padding-right: 0px;padding-left: 0px;padding-bottom: 0px;margin: 0px;padding-top: 0px"><strong>Update: </strong><a href="http://blogs.southworks.net/dschenkelman">Damian Schenkelman </a>has posted <a href="http://blogs.southworks.net/dschenkelman/2009/06/23/webbrowser-control-quickstart-for-the-composite-application-guidance-for-wpf-and-silverlight-prism-v2/">WebBrowser control Quickstart for the Composite Application Guidance for WPF and Silverlight (Prism-v2</a>) where you can find and download the demo.</div>
<h3>The Problem</h3>
<p>I had a WCF service in place. It was working fine with a ASP.NET web app, but when I tried to cunsume it from a Prism-v2 module I got the following exception:</p>
<p><em>&#8216;System.InvalidOperationException: Could not find default endpoint element that references contract &#8216;CustomerService.ICustomerService&#8217; in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.</em></p>
<p align="center"><a href="http://blogs.southworks.net/matiasb/files/2009/06/image.png"><img src="http://blogs.southworks.net/matiasb/files/2009/06/image-thumb.png" border="0" alt="image" width="397" height="97" /></a></p>
<p>I was using the <strong>app.config </strong>that was generated by the WCF &#8220;add service reference&#8221; wizard. I checked it&#8217;s content but everything was fine.</p>
<h3>The solution</h3>
<p><strong>Move the app.confing to the Shell project!</strong><br />
In prism modules are loaded dynamically, so they all run in the Shell project context. WCF was not finding my app.config because it was not in the right place.</p>
<p align="center"><a href="http://blogs.southworks.net/matiasb/files/2009/06/image1.png"><img src="http://blogs.southworks.net/matiasb/files/2009/06/image-thumb1.png" border="0" alt="image" width="163" height="273" /></a></p>
<p align="center"> </p>
<p style="text-align: left">This will do for simple applications, but most general application already have an app.config with settings. On the other hand, modules should be completely decoupled from the shell. A good way to resolve these issues is to set WCF configuration within the module programatically.</p>
<p align="left">I hope this is useful when consuming WCF Services from Prism Modules.<br />
 </p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.southworks.net%2fmatiasb%2f2009%2f06%2f20%2fhow-to-consume-wcf-services-from-composite-application-guidance-for-wpf-and-silverlightprism-v2-modules%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.southworks.net%2fmatiasb%2f2009%2f06%2f20%2fhow-to-consume-wcf-services-from-composite-application-guidance-for-wpf-and-silverlightprism-v2-modules%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Migrating Composite Application Guidance (Prism-v2) to XBAP</title>
		<link>http://blogs.southworks.net/matiasb/2009/03/11/using-cal-with-xbap-applications/</link>
		<comments>http://blogs.southworks.net/matiasb/2009/03/11/using-cal-with-xbap-applications/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 02:23:26 +0000</pubDate>
		<dc:creator>Matias Bonaventura</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/matiasb/2009/03/11/using-cal-with-xbap-applications/</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/matiasb/2009/03/11/using-cal-with-xbap-applications/" class="more-link">read more<img src="http://blogs.southworks.net/matiasb/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve seen that there are quite a few questions on how to use <strong>Composite Application Guidance for WPF and Silverlight</strong>  (a.k.a Prism) with XBAP applications on the <a href="http://compositewpf.codeplex.com/Thread/List.aspx?SearchText=xbap">discussion list</a>, so I&#8217;ll try show you in this post how to migrate the <strong>HelloWorld</strong> demo (included with <a href="http://msdn.microsoft.com/en-us/library/dd458809.aspx">CAL</a>) to XBAP.  If you are in a hurry, you can skip directly to the Solution.</p>
<h4>Problem</h4>
<p>The main issue is that XBAP applications rely on WPF framework to create the <strong>NavigationWindow</strong>s that will be holding XBAP pages and CAL needs to create the main window on the Bootstrapper (creating instances of <strong>NavigationWindow</strong>s is not allowed in PartialTrust applications).</p>
<p>The first thing that you will  do to convert your WPF application into an XBAP application is changing <strong>&lt;Window&gt;</strong> for <strong>&lt;Page&gt;</strong> in you XAMLs. In most scenarios that is practically all you have to do because WPF framework is intelligent enough to create the right environment for the application: If you are using <strong>Window</strong>s, it just creates a new instance of a window and calls it&#8217;s <strong>Show </strong>method (like you usually do in the CAL&#8217;s Bootstrapper). But if you are using <strong>Page</strong>s, it needs to host pages in <strong>NavigationWindow</strong>s or the Browser.</p>
<p>But, if you are using CAL after changing your <strong>Window</strong>s for <strong>Page</strong>s, you will end up commenting the call to the <strong>Show</strong> Method (pages don&#8217;t have a <strong>Show</strong> method) and setting the <strong>starupURI</strong> of the application. And that&#8217; were the root of the problem lies: WPF creates an instance of a <strong>Page</strong> and you are creating another instance in the Bootstrapper. That will mess up things and you will end up loosing references to the CAL&#8217;s regions and contentControls.</p>
<h4>Solution</h4>
<p>Based on Mokosh&#8217;s <a href="http://www.mokosh.co.uk/post/Prism-and-WPF-Browser-Application-(Xbap).aspx">Prism and WPF Browser Application (Xbap)</a> post that shows a good way run Prism v1 solution as XBAPs,  let&#8217;s migrate a Prism v2 solution to run as an XBAP application is as follows:</p>
<p>We will start with the <strong>HelloWorldDemo.Desktop </strong>Quickstart included in Prism v2<strong>.</strong></p>
<ol>
<li>Set the shell as the startup page of the application. To do that, open the <strong>App.xml</strong> file and add <strong>StartupUri=&#8221;Shell.xaml&#8221;</strong> to the <strong>&lt;Application&gt;</strong> element.<br />
<span style="color: #0000ff">&lt;</span><span style="color: #a31515">Application </span><span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">HelloWorld.App</span>&#8221;<br />
<span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">http://schemas.microsoft.com/winfx/2006/xaml/presentation</span>&#8221;<br />
<span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">http://schemas.microsoft.com/winfx/2006/xaml</span>&#8221;<br />
<strong><span style="color: #ff0000">StartupUri</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">Shell.xaml</span>&#8220;</strong><span style="color: #0000ff">&gt;<br />
  &lt;</span><span style="color: #a31515">Application.Resources</span><span style="color: #0000ff">&gt;<br />
  &lt;/</span><span style="color: #a31515">Application.Resources</span><span style="color: #0000ff">&gt;<br />
&lt;/</span><span style="color: #a31515">Application</span><span style="color: #0000ff">&gt;</span></li>
<p><a href="http://11011.net/software/vspaste"></a></p>
<li>In the <strong>App.xaml</strong> code behind (<strong>App.xaml.cs</strong>) remove the <strong>OnStartup </strong>method. We will add the <strong>BootStrapper</strong> initialization afterwards.</li>
<li>In the <strong>Shell.xaml </strong>file change the <strong>&lt;Window&gt;</strong> element for a <strong>&lt;Page&gt;</strong> element. You should end up with the <strong>Shell.xaml</strong> code as follows:<br />
<strong><span style="color: #0000ff">&lt;</span><span style="color: #a31515">Page </span></strong><span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">HelloWorld.Shell</span>&#8221;<br />
<span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">http://schemas.microsoft.com/winfx/2006/xaml/presentation</span>&#8221;<br />
<span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">http://schemas.microsoft.com/winfx/2006/xaml</span>&#8221;<br />
<span style="color: #ff0000">xmlns:cal</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">http://www.codeplex.com/CompositeWPF</span>&#8221;<br />
<span style="color: #ff0000">Title</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">Hello World</span>&#8221; <span style="color: #ff0000">Height</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">300</span>&#8221; <span style="color: #ff0000">Width</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">300</span>&#8220;<span style="color: #0000ff">&gt;<br />
  &lt;</span><span style="color: #a31515">ItemsControlName</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">MainRegion</span>&#8221; <span style="color: #0000ff">/&gt;<br />
<strong>&lt;/</strong></span><strong><span style="color: #a31515">Page</span><span style="color: #0000ff">&gt;</span></strong></li>
<p><a href="http://11011.net/software/vspaste"></a></p>
<li>In the <strong>Shell.cs </strong>make <strong>Shell </strong>inherit from <strong>Page </strong>instead of <strong>Window. </strong>Ej: <span style="color: #0000ff">public partial class </span><span style="color: #2b91af">Shell </span>: <span style="color: #2b91af">Page</span></li>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></p>
<li>To avoid creating a new instance of the shell, get the one created during the Application startup.  A good place to do that is the <strong>Shell</strong> constructor.</li>
<pre><span style="color: #0000ff">public </span>Shell()
{
    Bootstrapper bootStrapper = <span style="color: #0000ff">new </span>Bootstrapper();
    bootStrapper.ShellPage = <span style="color: #0000ff">this</span>;
    bootStrapper.Run();

    InitializeComponent();
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<li>Now we will need to add a property to the <strong>Bootstrapper </strong>class to have a reference to the <strong>Shell</strong> and  then return it in the <strong>CreateShell</strong> method. So the complete <strong>Bootstrapper</strong> code should be:</li>
<pre><span style="color: #0000ff">class </span><span style="color: #2b91af">Bootstrapper </span>: UnityBootstrapper
{
    <span style="color: #0000ff">private </span>DependencyObject shellPage;
    <span style="color: #0000ff">public </span>DependencyObject ShellPage
    {
        <span style="color: #0000ff">get
        </span>{
            <span style="color: #0000ff">return </span>shellPage;
        }

        <span style="color: #0000ff">set
        </span>{
            shellPage = <span style="color: #0000ff">value</span>;
        }
    }

    <span style="color: #0000ff">protected override </span>DependencyObject CreateShell()
    {
        <span style="color: #0000ff">return </span>ShellPage;
    }

    <span style="color: #0000ff">protected override </span>IModuleCatalog GetModuleCatalog()
    {
        ModuleCatalog catalog = <span style="color: #0000ff">new </span>ModuleCatalog()
            .AddModule(<span style="color: #0000ff">typeof</span>(HelloWorldModule.HelloWorldModule));
        <span style="color: #0000ff">return </span>catalog;
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<li>Press <strong>F5</strong> and Enjoy!</li>
</ol>
<p><strong>Further improvements:</strong></p>
<ul>
<li>You can host the XBAP application directly in the browser if you follow these 6 steps proposed by Charles: <a href="http://www.charlespetzold.com/blog/2006/11/120718.html">Converting EXE Projects to XBAPs</a></li>
<li>You can take a look at <a href="http://blogs.southworks.net/dschenkelman/">Damian</a>&#8216;s migration of the Reference Implementation and download the XBAP RI: <a href="http://blogs.southworks.net/dschenkelman/2009/03/13/composite-application-guidance-for-wpf-silverlight-prism-v2-reference-implementation-migrated-to-xbap/">Composite Application Guidance for WPF &amp; Silverlight (Prism v2) Reference Implementation migrated to XBap</a></li>
</ul>
<p><a href="http://blogs.southworks.net/matiasb/files/2009/04/clip-image002.gif"><img src="http://blogs.southworks.net/matiasb/files/2009/04/clip-image002-thumb.gif" border="0" alt="clip_image002" width="244" height="243" /></a> <a href="http://blogs.southworks.net/matiasb/files/2009/04/clip-image004.gif"><img src="http://blogs.southworks.net/matiasb/files/2009/04/clip-image004-thumb.gif" border="0" alt="clip_image004" width="244" height="235" /></a></p>
<p>Technorati Tags: <a href="http://technorati.com/tags/Patterns%20and%20Practices">Patterns and Practices</a>,<a href="http://technorati.com/tags/Composite%20Application%20Guidance">Composite Application Guidance</a>,<a href="http://technorati.com/tags/WPF">WPF</a>,<a href="http://technorati.com/tags/XBAP">XBAP</a>,<a href="http://technorati.com/tags/Prism">Prism</a>,<a href="http://technorati.com/tags/CAL">CAL</a><br />
<a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.southworks.net%2fmatiasb%2f2009%2f03%2f11%2fusing-cal-with%e2%80%a6p-applicationsusing-cal-with-xbap-applications%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.southworks.net%2fmatiasb%2f2009%2f03%2f11%2fusing-cal-with%e2%80%a6p-applicationsusing-cal-with-xbap-applications%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SQL Services</title>
		<link>http://blogs.southworks.net/matiasb/2008/11/08/sql-services/</link>
		<comments>http://blogs.southworks.net/matiasb/2008/11/08/sql-services/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 09:53:44 +0000</pubDate>
		<dc:creator>Matias Bonaventura</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[SQL Services]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/matiasb/?p=10</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/matiasb/2008/11/08/sql-services/" class="more-link">read more<img src="http://blogs.southworks.net/matiasb/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>Comming soon!</p>
<p> </p>
<p><a href="http://blogs.southworks.net/matiasb/files/2008/11/sql-services.jpg"><img class="alignnone size-medium wp-image-11" src="http://blogs.southworks.net/matiasb/files/2008/11/sql-services.jpg" alt="" width="300" height="168" /></a></p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
