<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Felice Pollano Blog - Caliburn</title>
    <link>http://www.felicepollano.com/</link>
    <description>The official Fatica Labs Blog!</description>
    <language>en-us</language>
    <copyright>Felice Pollano</copyright>
    <lastBuildDate>Thu, 03 Nov 2011 19:52:59 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>felice@felicepollano.com</managingEditor>
    <webMaster>felice@felicepollano.com</webMaster>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=9dcc8717-eb83-45b5-ac89-2f0d0cf05bde</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink.aspx?guid=9dcc8717-eb83-45b5-ac89-2f0d0cf05bde</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView.aspx?guid=9dcc8717-eb83-45b5-ac89-2f0d0cf05bde</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=9dcc8717-eb83-45b5-ac89-2f0d0cf05bde</wfw:commentRss>
      <slash:comments>6</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
As we know the <a href="http://caliburnmicro.codeplex.com/" target="_blank"></a><a href="http://caliburnmicro.codeplex.com/" target="_blank">Caliburn
Micro</a> library implements a screen conductor to handle multiple screen models with
only one active, typically used for tabbed views, that is easy to implement by deriving
your model from <strong>Conductor&lt;IScreen&gt;.Collection.OneActive</strong>. This
works out of the box with the standard tab control, but it is not possible to use
it for example with the tabbed documents in <a href="http://avalondock.codeplex.com/" target="_blank">AvalonDock</a>.
The only solution I found, that for some reason I will say below, <a href="http://frankmao.com/2010/11/19/when-caliburn-micro-meets-avalondock/" target="_blank">is
this one</a>. I don’t like this solution because it force to write code inside the
view, that is not acceptable in a pure <a href="http://en.wikipedia.org/wiki/Model_View_ViewModel" target="_blank">MVVM</a> solution,
so I preferred to insulate the code in an attached behavior. In addition the presented
solution will works correctly with the Activate/Deactivate/CanClose strategy on each
document. We just need to modify the view markup as in the example below:
</p>
        <p>
        </p>
        <script src="https://gist.github.com/1336844.js?file=mainview.xaml">
        </script>
As you can see we just added an attached property UseConductor.DocumentConductor that
we bind to the current model. Of course the model is a OneActive screen conductor.
The behavior take care to connect the document items of the DocumentPane with the
screen conductor items. If each screen implements IScreen, the proper Activate/Deactivate/CanClose
are called, so we can even handle the case of canceling the close of a dirty document.
Here the attached behavior code: <script src="https://gist.github.com/1336844.js?file=UseConductor.cs"></script>An
example MainModel can be the following one: 
<p></p><p><script src="https://gist.github.com/1336844.js?file=mainviewmodel.cs"></script></p><p>
( we just add some random document to see how it behave ) 
</p><p>
And here below an example of a single screen  model:
</p><script src="https://gist.github.com/1336844.js?file=TabModel.cs"></script><p>
So we have the conductor, without touching the view code, and without creating a custom
screen conductor.
</p><img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=9dcc8717-eb83-45b5-ac89-2f0d0cf05bde" /></body>
      <title>AvalonDock and Caliburn Micro Screen Conductor</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink.aspx?guid=9dcc8717-eb83-45b5-ac89-2f0d0cf05bde</guid>
      <link>http://www.felicepollano.com/2011/11/03/AvalonDockAndCaliburnMicroScreenConductor.aspx</link>
      <pubDate>Thu, 03 Nov 2011 19:52:59 GMT</pubDate>
      <description>&lt;p&gt;
As we know the &lt;a href="http://caliburnmicro.codeplex.com/" target="_blank"&gt;&lt;/a&gt;&lt;a href="http://caliburnmicro.codeplex.com/" target="_blank"&gt;Caliburn
Micro&lt;/a&gt; library implements a screen conductor to handle multiple screen models with
only one active, typically used for tabbed views, that is easy to implement by deriving
your model from &lt;strong&gt;Conductor&amp;lt;IScreen&amp;gt;.Collection.OneActive&lt;/strong&gt;. This
works out of the box with the standard tab control, but it is not possible to use
it for example with the tabbed documents in &lt;a href="http://avalondock.codeplex.com/" target="_blank"&gt;AvalonDock&lt;/a&gt;.
The only solution I found, that for some reason I will say below, &lt;a href="http://frankmao.com/2010/11/19/when-caliburn-micro-meets-avalondock/" target="_blank"&gt;is
this one&lt;/a&gt;. I don’t like this solution because it force to write code inside the
view, that is not acceptable in a pure &lt;a href="http://en.wikipedia.org/wiki/Model_View_ViewModel" target="_blank"&gt;MVVM&lt;/a&gt; solution,
so I preferred to insulate the code in an attached behavior. In addition the presented
solution will works correctly with the Activate/Deactivate/CanClose strategy on each
document. We just need to modify the view markup as in the example below:
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;script src="https://gist.github.com/1336844.js?file=mainview.xaml"&gt;&lt;/script&gt;
As you can see we just added an attached property UseConductor.DocumentConductor that
we bind to the current model. Of course the model is a OneActive screen conductor.
The behavior take care to connect the document items of the DocumentPane with the
screen conductor items. If each screen implements IScreen, the proper Activate/Deactivate/CanClose
are called, so we can even handle the case of canceling the close of a dirty document.
Here the attached behavior code: &lt;script src="https://gist.github.com/1336844.js?file=UseConductor.cs"&gt;&lt;/script&gt;An
example MainModel can be the following one: 
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;script src="https://gist.github.com/1336844.js?file=mainviewmodel.cs"&gt;&lt;/script&gt;
&lt;/p&gt;
&lt;p&gt;
( we just add some random document to see how it behave ) 
&lt;/p&gt;
&lt;p&gt;
And here below an example of a single screen&amp;nbsp; model:
&lt;/p&gt;
&lt;script src="https://gist.github.com/1336844.js?file=TabModel.cs"&gt;&lt;/script&gt;
&lt;p&gt;
So we have the conductor, without touching the view code, and without creating a custom
screen conductor.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=9dcc8717-eb83-45b5-ac89-2f0d0cf05bde" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView.aspx?guid=9dcc8717-eb83-45b5-ac89-2f0d0cf05bde</comments>
      <category>Caliburn</category>
      <category>WPF</category>
      <category>CodeProject</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=f4abd863-99ee-4385-859a-cee539a7a460</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink.aspx?guid=f4abd863-99ee-4385-859a-cee539a7a460</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView.aspx?guid=f4abd863-99ee-4385-859a-cee539a7a460</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=f4abd863-99ee-4385-859a-cee539a7a460</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you plan to use the <a href="http://caliburnmicro.codeplex.com/" target="_blank">Caliburn
Micro</a> convention with buttons contained in a <a href="http://fluent.codeplex.com/" target="_blank">Fluent
Ribbon</a> you will notice that it does not works out of the box. This is because
the default BindingScope.GetNamedElements does not dig inside the ribbon to looks
for named control. The solution that worked for me is to modify the default behavior
as swown below:
</p>
        <p>
In the overridden Configure function: 
</p>
        <p>
…
</p>
        <pre class="code">defaultElementLookup = <span style="color: #2b91af">BindingScope</span>.GetNamedElements; <span style="color: #2b91af">BindingScope</span>.GetNamedElements
= <span style="color: blue">new </span><span style="color: #2b91af">Func</span>&lt;System.Windows.<span style="color: #2b91af">DependencyObject</span>, <span style="color: #2b91af">IEnumerable</span>&lt;System.Windows.<span style="color: #2b91af">FrameworkElement</span>&gt;&gt;(
k =&gt; { <span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">FrameworkElement</span>&gt;
namedElements = <span style="color: blue">new </span><span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">FrameworkElement</span>&gt;();
namedElements.AddRange(defaultElementLookup(k)); Fluent.<span style="color: #2b91af">Ribbon </span>ribbon
= LookForRibbon(k); <span style="color: blue">if</span>( <span style="color: blue">null </span>!=
ribbon ) AppendRibbonNamedItem(ribbon, namedElements); <span style="color: blue">return </span>namedElements;
} ); </pre>
        <p>
…
</p>
        <p>
We need to define defaultElementLookup into the boot class as:
</p>
        <pre class="code">
          <span style="color: #2b91af">Func</span>&lt;<span style="color: #2b91af">DependencyObject</span>, <span style="color: #2b91af">IEnumerable</span>&lt;<span style="color: #2b91af">FrameworkElement</span>&gt;&gt;
defaultElementLookup; I saved the standard GetNamedElement function because I use
it to look for the control the default way, and to look for the controls inside the
Ribbon too.</pre>
        <p>
Here the function <strong>LookForRibbon</strong>, that just dig into the visual tree
to search for a ribbbon ( if any ):
</p>
        <pre class="code">
          <span style="color: blue">private </span>Fluent.<span style="color: #2b91af">Ribbon </span>LookForRibbon(<span style="color: #2b91af">DependencyObject </span>k)
{ Fluent.<span style="color: #2b91af">Ribbon </span>foundRibbon = <span style="color: blue">null</span>; <span style="color: blue">var </span>contentControl
= k <span style="color: blue">as </span><span style="color: #2b91af">ContentControl</span>; <span style="color: blue">if </span>(<span style="color: blue">null </span>!=
contentControl) { <span style="color: blue">var </span>child = contentControl.Content <span style="color: blue">as </span><span style="color: #2b91af">DependencyObject</span>; <span style="color: blue">if</span>( <span style="color: blue">null </span>!=
child ) <span style="color: blue">return </span>LookForRibbon(child); } <span style="color: blue">for </span>(<span style="color: blue">int </span>i
= 0; i &lt; <span style="color: #2b91af">VisualTreeHelper</span>.GetChildrenCount(k);
++i) { <span style="color: blue">var </span>child = <span style="color: #2b91af">VisualTreeHelper</span>.GetChild(k,
i); foundRibbon = child <span style="color: blue">as </span>Fluent.<span style="color: #2b91af">Ribbon</span>; <span style="color: blue">if </span>(<span style="color: blue">null </span>!=
foundRibbon) { <span style="color: blue">return </span>foundRibbon; } <span style="color: blue">else </span>{
foundRibbon = LookForRibbon(child); <span style="color: blue">if </span>(<span style="color: blue">null </span>!=
foundRibbon) <span style="color: blue">return </span>foundRibbon; } } <span style="color: blue">return
null</span>; } </pre>
        <p>
 
</p>
        <p>
As you guess, the function stops at the first found ribbon so we suppose there is
just one ribbon for view ( quite reasonable )
</p>
        <p>
As we have the ribbon we can look for the elements inside and append to the list with
this function:
</p>
        <p>
 
</p>
        <pre class="code">
          <span style="color: blue">private void </span>AppendRibbonNamedItem(Fluent.<span style="color: #2b91af">Ribbon </span>ribbon, <span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">FrameworkElement</span>&gt;
namedElements) { <span style="color: blue">foreach </span>(<span style="color: blue">var </span>ti <span style="color: blue">in </span>ribbon.Tabs)
{ <span style="color: blue">foreach </span>(<span style="color: blue">var </span>group <span style="color: blue">in </span>ti.Groups)
{ namedElements.AddRange(defaultElementLookup(group)); } } } </pre>
        <p>
 
</p>
        <p>
So we look inside each ribbon group and we treat these as Caliburn would do.
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=f4abd863-99ee-4385-859a-cee539a7a460" />
      </body>
      <title>Using Fluent Ribbon with Caliburn</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink.aspx?guid=f4abd863-99ee-4385-859a-cee539a7a460</guid>
      <link>http://www.felicepollano.com/2011/07/21/UsingFluentRibbonWithCaliburn.aspx</link>
      <pubDate>Thu, 21 Jul 2011 13:35:52 GMT</pubDate>
      <description>&lt;p&gt;
If you plan to use the &lt;a href="http://caliburnmicro.codeplex.com/" target="_blank"&gt;Caliburn
Micro&lt;/a&gt; convention with buttons contained in a &lt;a href="http://fluent.codeplex.com/" target="_blank"&gt;Fluent
Ribbon&lt;/a&gt; you will notice that it does not works out of the box. This is because
the default BindingScope.GetNamedElements does not dig inside the ribbon to looks
for named control. The solution that worked for me is to modify the default behavior
as swown below:
&lt;/p&gt;
&lt;p&gt;
In the overridden Configure function: 
&lt;/p&gt;
&lt;p&gt;
…
&lt;/p&gt;
&lt;pre class="code"&gt;defaultElementLookup = &lt;span style="color: #2b91af"&gt;BindingScope&lt;/span&gt;.GetNamedElements; &lt;span style="color: #2b91af"&gt;BindingScope&lt;/span&gt;.GetNamedElements
= &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Func&lt;/span&gt;&amp;lt;System.Windows.&lt;span style="color: #2b91af"&gt;DependencyObject&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;System.Windows.&lt;span style="color: #2b91af"&gt;FrameworkElement&lt;/span&gt;&amp;gt;&amp;gt;(
k =&amp;gt; { &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;FrameworkElement&lt;/span&gt;&amp;gt;
namedElements = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;FrameworkElement&lt;/span&gt;&amp;gt;();
namedElements.AddRange(defaultElementLookup(k)); Fluent.&lt;span style="color: #2b91af"&gt;Ribbon &lt;/span&gt;ribbon
= LookForRibbon(k); &lt;span style="color: blue"&gt;if&lt;/span&gt;( &lt;span style="color: blue"&gt;null &lt;/span&gt;!=
ribbon ) AppendRibbonNamedItem(ribbon, namedElements); &lt;span style="color: blue"&gt;return &lt;/span&gt;namedElements;
} ); &lt;/pre&gt;
&lt;p&gt;
…
&lt;/p&gt;
&lt;p&gt;
We need to define defaultElementLookup into the boot class as:
&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;Func&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;DependencyObject&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;FrameworkElement&lt;/span&gt;&amp;gt;&amp;gt;
defaultElementLookup; I saved the standard GetNamedElement function because I use
it to look for the control the default way, and to look for the controls inside the
Ribbon too.&lt;/pre&gt;
&lt;p&gt;
Here the function &lt;strong&gt;LookForRibbon&lt;/strong&gt;, that just dig into the visual tree
to search for a ribbbon ( if any ):
&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private &lt;/span&gt;Fluent.&lt;span style="color: #2b91af"&gt;Ribbon &lt;/span&gt;LookForRibbon(&lt;span style="color: #2b91af"&gt;DependencyObject &lt;/span&gt;k)
{ Fluent.&lt;span style="color: #2b91af"&gt;Ribbon &lt;/span&gt;foundRibbon = &lt;span style="color: blue"&gt;null&lt;/span&gt;; &lt;span style="color: blue"&gt;var &lt;/span&gt;contentControl
= k &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ContentControl&lt;/span&gt;; &lt;span style="color: blue"&gt;if &lt;/span&gt;(&lt;span style="color: blue"&gt;null &lt;/span&gt;!=
contentControl) { &lt;span style="color: blue"&gt;var &lt;/span&gt;child = contentControl.Content &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DependencyObject&lt;/span&gt;; &lt;span style="color: blue"&gt;if&lt;/span&gt;( &lt;span style="color: blue"&gt;null &lt;/span&gt;!=
child ) &lt;span style="color: blue"&gt;return &lt;/span&gt;LookForRibbon(child); } &lt;span style="color: blue"&gt;for &lt;/span&gt;(&lt;span style="color: blue"&gt;int &lt;/span&gt;i
= 0; i &amp;lt; &lt;span style="color: #2b91af"&gt;VisualTreeHelper&lt;/span&gt;.GetChildrenCount(k);
++i) { &lt;span style="color: blue"&gt;var &lt;/span&gt;child = &lt;span style="color: #2b91af"&gt;VisualTreeHelper&lt;/span&gt;.GetChild(k,
i); foundRibbon = child &lt;span style="color: blue"&gt;as &lt;/span&gt;Fluent.&lt;span style="color: #2b91af"&gt;Ribbon&lt;/span&gt;; &lt;span style="color: blue"&gt;if &lt;/span&gt;(&lt;span style="color: blue"&gt;null &lt;/span&gt;!=
foundRibbon) { &lt;span style="color: blue"&gt;return &lt;/span&gt;foundRibbon; } &lt;span style="color: blue"&gt;else &lt;/span&gt;{
foundRibbon = LookForRibbon(child); &lt;span style="color: blue"&gt;if &lt;/span&gt;(&lt;span style="color: blue"&gt;null &lt;/span&gt;!=
foundRibbon) &lt;span style="color: blue"&gt;return &lt;/span&gt;foundRibbon; } } &lt;span style="color: blue"&gt;return
null&lt;/span&gt;; } &lt;/pre&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
As you guess, the function stops at the first found ribbon so we suppose there is
just one ribbon for view ( quite reasonable )
&lt;/p&gt;
&lt;p&gt;
As we have the ribbon we can look for the elements inside and append to the list with
this function:
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;AppendRibbonNamedItem(Fluent.&lt;span style="color: #2b91af"&gt;Ribbon &lt;/span&gt;ribbon, &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;FrameworkElement&lt;/span&gt;&amp;gt;
namedElements) { &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: blue"&gt;var &lt;/span&gt;ti &lt;span style="color: blue"&gt;in &lt;/span&gt;ribbon.Tabs)
{ &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: blue"&gt;var &lt;/span&gt;group &lt;span style="color: blue"&gt;in &lt;/span&gt;ti.Groups)
{ namedElements.AddRange(defaultElementLookup(group)); } } } &lt;/pre&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
So we look inside each ribbon group and we treat these as Caliburn would do.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=f4abd863-99ee-4385-859a-cee539a7a460" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView.aspx?guid=f4abd863-99ee-4385-859a-cee539a7a460</comments>
      <category>Caliburn</category>
      <category>WPF</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=2ee7b1b6-1699-4a5e-9894-1374ffbb7b8b</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink.aspx?guid=2ee7b1b6-1699-4a5e-9894-1374ffbb7b8b</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView.aspx?guid=2ee7b1b6-1699-4a5e-9894-1374ffbb7b8b</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=2ee7b1b6-1699-4a5e-9894-1374ffbb7b8b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The current ( trunk ) implementation of <a href="http://caliburnmicro.codeplex.com/" target="_blank">Caliburn
Micro</a> introduces a new element in the phase of obtaining the view type name from
the model name. The name of the View type is obtained from the name of the ViewModel
type by applying a series of rules based on <a href="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.aspx" target="_blank">RegEx</a> match
and replace patterns. These rules has some defaults values, but others can be added
externally by calling 
</p>
        <pre>NameTransformer.AddRule<br /></pre>
        <p>
There is an important default that is given by the following pattern:
</p>
        <pre class="code">NameTransformer.AddRule(<span style="color: #a31515">"Model$"</span>, <span style="color: blue">string</span>.Empty); </pre>
        <p>
          <a href="http://11011.net/software/vspaste">
          </a> 
</p>
        <p>
This is the rule that allow old model view naming convention works properly.
</p>
        <p>
If you have some not up-to-date trunk version you can experience some problem, have
a <a href="http://caliburnmicro.codeplex.com/discussions/259459" target="_blank">look
at this discussion</a>. The current doc of <a href="http://caliburnmicro.codeplex.com/SourceControl/changeset/view/4c2a9daf9828#src%2fCaliburn.Micro.Silverlight%2fNameTransformer.cs" target="_blank">NameTrasformer</a> is
the source code of the <a href="http://caliburnmicro.codeplex.com/SourceControl/changeset/view/4c2a9daf9828#src%2fCaliburn.Micro.Silverlight%2fViewLocator.cs" target="_blank">ViewLocator</a> and
the <a href="http://caliburnmicro.codeplex.com/SourceControl/changeset/view/4c2a9daf9828#src%2fCaliburn.Micro.Silverlight%2fViewModelLocator.cs" target="_blank">ViewModelLocator</a> from
which you can derive what conventions are applied.
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=2ee7b1b6-1699-4a5e-9894-1374ffbb7b8b" />
      </body>
      <title>Caliburn Micro: NameTransformer</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink.aspx?guid=2ee7b1b6-1699-4a5e-9894-1374ffbb7b8b</guid>
      <link>http://www.felicepollano.com/2011/06/01/CaliburnMicroNameTransformer.aspx</link>
      <pubDate>Wed, 01 Jun 2011 12:41:00 GMT</pubDate>
      <description>&lt;p&gt;
The current ( trunk ) implementation of &lt;a href="http://caliburnmicro.codeplex.com/" target="_blank"&gt;Caliburn
Micro&lt;/a&gt; introduces a new element in the phase of obtaining the view type name from
the model name. The name of the View type is obtained from the name of the ViewModel
type by applying a series of rules based on &lt;a href="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.aspx" target="_blank"&gt;RegEx&lt;/a&gt; match
and replace patterns. These rules has some defaults values, but others can be added
externally by calling 
&lt;/p&gt;
&lt;pre&gt;NameTransformer.AddRule&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
There is an important default that is given by the following pattern:
&lt;/p&gt;
&lt;pre class="code"&gt;NameTransformer.AddRule(&lt;span style="color: #a31515"&gt;"Model$"&lt;/span&gt;, &lt;span style="color: blue"&gt;string&lt;/span&gt;.Empty); &lt;/pre&gt;
&lt;p&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
This is the rule that allow old model view naming convention works properly.
&lt;/p&gt;
&lt;p&gt;
If you have some not up-to-date trunk version you can experience some problem, have
a &lt;a href="http://caliburnmicro.codeplex.com/discussions/259459" target="_blank"&gt;look
at this discussion&lt;/a&gt;. The current doc of &lt;a href="http://caliburnmicro.codeplex.com/SourceControl/changeset/view/4c2a9daf9828#src%2fCaliburn.Micro.Silverlight%2fNameTransformer.cs" target="_blank"&gt;NameTrasformer&lt;/a&gt; is
the source code of the &lt;a href="http://caliburnmicro.codeplex.com/SourceControl/changeset/view/4c2a9daf9828#src%2fCaliburn.Micro.Silverlight%2fViewLocator.cs" target="_blank"&gt;ViewLocator&lt;/a&gt; and
the &lt;a href="http://caliburnmicro.codeplex.com/SourceControl/changeset/view/4c2a9daf9828#src%2fCaliburn.Micro.Silverlight%2fViewModelLocator.cs" target="_blank"&gt;ViewModelLocator&lt;/a&gt; from
which you can derive what conventions are applied.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=2ee7b1b6-1699-4a5e-9894-1374ffbb7b8b" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView.aspx?guid=2ee7b1b6-1699-4a5e-9894-1374ffbb7b8b</comments>
      <category>Caliburn</category>
      <category>WPF</category>
    </item>
  </channel>
</rss>