<?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>Shazaml Design, LLC &#187; Caliburn</title>
	<atom:link href="http://www.shazaml.com/archives/tag/caliburn/feed" rel="self" type="application/rss+xml" />
	<link>http://www.shazaml.com</link>
	<description>Design and Development for Windows Phone 7</description>
	<lastBuildDate>Thu, 27 Oct 2011 19:33:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>A Caliburn.Micro recipe: filters &#171; Marco Amendola</title>
		<link>http://www.shazaml.com/archives/caliburn-micro-filters</link>
		<comments>http://www.shazaml.com/archives/caliburn-micro-filters#comments</comments>
		<pubDate>Tue, 10 Aug 2010 22:30:35 +0000</pubDate>
		<dc:creator>Mark Tucker</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Caliburn]]></category>
		<category><![CDATA[Caliburn.Micro]]></category>
		<category><![CDATA[filter]]></category>

		<guid isPermaLink="false">http://www.shazaml.com/?p=632</guid>
		<description><![CDATA[Caliburn.Micro implementation of Filters]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.shazaml.com/wp-content/uploads/2010/08/image6.png"><img style="display: inline; border-width: 0px;" title="image" src="http://www.shazaml.com/wp-content/uploads/2010/08/image_thumb5.png" border="0" alt="image" width="640" height="231" /></a></p>
<p>Extension to <a href="http://caliburnmicro.codeplex.com/">Caliburn.Micro</a> to allow implementation of filters similar to what is found in <a href="http://caliburn.codeplex.com/">Caliburn</a>.</p>
<p><a href="http://marcoamendola.wordpress.com/2010/08/10/a-caliburn-micro-recipe-filters/">A Caliburn.Micro recipe: filters « Marco Amendola</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shazaml.com/archives/caliburn-micro-filters/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Infragistics XamWebOutlookBar &amp; Caliburn</title>
		<link>http://www.shazaml.com/archives/infragistics-xamweboutlookbar-caliburn</link>
		<comments>http://www.shazaml.com/archives/infragistics-xamweboutlookbar-caliburn#comments</comments>
		<pubDate>Mon, 14 Jun 2010 21:38:44 +0000</pubDate>
		<dc:creator>Mark Tucker</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Caliburn]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[XamWebOutlookBar]]></category>

		<guid isPermaLink="false">http://www.shazaml.com/?p=571</guid>
		<description><![CDATA[Using the Infragistics Silverlight XamWebOutlookBar with Caliburn]]></description>
			<content:encoded><![CDATA[<p>Last week I set out to build a simple Caliburn sample that included the Infragistics Silverlight XamWebOutlookBar.  I made progress and got to a point where Rob Eisenberg was able to help me get the rest of the way.  The approach I was taking was trying to figure out what conventions I should add to get Caliburn to recognize the XamWebOutlookBar.  Rob’s answer was that not everything needs to be a convention.</p>
<p>When you run the application, you will see the XamWebOutlookBar hosted in a sidebar.  Both groups shown in the OutlookBar have corresponding ViewModels that in turn have associated Views:</p>
<p><a href="http://www.shazaml.com/wp-content/uploads/2010/06/image.png"><img style="display: inline; border: 0px;" title="image" src="http://www.shazaml.com/wp-content/uploads/2010/06/image_thumb.png" border="0" alt="image" width="261" height="202" /></a></p>
<p>At the end of the article is a link to the project source code.  In order to get the project to compile, you will need to download the Infragistics assemblies and add references to the following:</p>
<p><a href="http://www.shazaml.com/wp-content/uploads/2010/06/image1.png"><img style="display: inline; border: 0px;" title="image" src="http://www.shazaml.com/wp-content/uploads/2010/06/image_thumb1.png" border="0" alt="image" width="376" height="83" /></a></p>
<p>A trial of Infragistics can be downloaded from <a href="http://www.infragistics.com/dotnet/netadvantage/silverlight/line-of-businessdownloads.aspx">here</a>.</p>
<p>Here is the final project structure:</p>
<p><a href="http://www.shazaml.com/wp-content/uploads/2010/06/image2.png"><img style="display: inline; border: 0px;" title="image" src="http://www.shazaml.com/wp-content/uploads/2010/06/image_thumb2.png" border="0" alt="image" width="300" height="484" /></a></p>
<h2>Application</h2>
<p>In typical Caliburn style, the App.xaml has been changed to a CaliburnApplication:</p>
<pre class="brush: xml; gutter: false; title: ; notranslate">
&lt;cal:CaliburnApplication xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
             xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
             xmlns:cal=&quot;clr-namespace:Caliburn.PresentationFramework.ApplicationModel;assembly=Caliburn.PresentationFramework&quot;
             x:Class=&quot;InfragisticsCaliburn.App&quot;&gt;
    &lt;Application.Resources&gt;
    &lt;/Application.Resources&gt;
&lt;/cal:CaliburnApplication&gt;
</pre>
<p>In App.xaml.cs, we setup MEF as the container and the use MEF to find the ShellViewModel:</p>
<pre class="brush: csharp; gutter: false; title: ; notranslate">
protected override IServiceLocator CreateContainer()
{
    return new MEFAdapter(CompositionHost.Initialize(new AssemblyCatalog(Assembly.GetExecutingAssembly())));
}

protected override object CreateRootModel()
{
    var shell = ServiceLocator.Current.GetInstance&lt;IShell&gt;();

    if (IsRunningOutOfBrowser &amp;&amp; HasElevatedPermissions)
        MainWindow.Closing += (s, args) =&gt; { args.Cancel = !ServiceLocator.Current.GetInstance&lt;IShell&gt;().CanShutdown(); };

    return shell;
}
</pre>
<h2>ViewModels</h2>
<p>MEF is able to find ShellViewModel in the container using the IShell type because it implements IShell and Exports itself as IShell:</p>
<pre class="brush: csharp; gutter: false; title: ; notranslate">
[Export(typeof(IShell))]
public class ShellViewModel : ScreenConductor&lt;IScreen&gt;, IShell
{
    private readonly MainViewModel _firstScreen;

    [ImportingConstructor]
    public ShellViewModel(MainViewModel firstScreen)
    {
        _firstScreen = firstScreen;
    }

    protected override void OnInitialize()
    {
        this.OpenScreen(_firstScreen);
    }

}
</pre>
<p>Because of the ImportingConstructor attribute, an instance of MainViewModel is created.  The class is implemented as:</p>
<pre class="brush: csharp; gutter: false; title: ; notranslate">
[Export(typeof(MainViewModel))]
public class MainViewModel : ScreenConductor&lt;ISidebarItem&gt;.WithCollection.OneScreenActive
{
    [ImportingConstructor]
    public MainViewModel([ImportMany] IEnumerable&lt;ISidebarItem&gt; sidebars)
    {
        Screens.AddRange(sidebars);
        this.OpenScreen(Screens.First());
    }
}
</pre>
<p>For the XamWebOutlookBar implementation, the important thing to note is that MainViewModel is setup as a ScreenConductor that manages ISidebarItem instances where only one sidebar screen is active at a time.  The ImportingConstructor attribute then finds all items registered in the MEF container as ISidebarItem.</p>
<p>In this example, both ContentAViewAModel and ContentBViewModel are similar:</p>
<pre class="brush: csharp; gutter: false; title: ; notranslate">
[Export(typeof(ISidebarItem))]
public class ContentAViewModel : Screen, ISidebarItem
{
    string message = &quot;ContentA is working&quot;;

    public ContentAViewModel()
    {
        DisplayName = &quot;Content A Header&quot;;
    }

    public string Message
    {
        get { return message; }
        set
        {
            message = value;
            NotifyOfPropertyChange(() =&gt; Message);
        }
    }

    public string Icon
    {
        get { return @&quot;../../Images/briefcase2.png&quot;; }
    }
}
</pre>
<p>Each of the ViewModels export themselves as ISidebarItem, inherit from Screen, and implement ISidebarItem.</p>
<h2>Views</h2>
<p>In MainView.xaml, the DisplayName and Icon properties are used to render the group’s header and icon:</p>
<pre class="brush: xml; gutter: false; title: ; notranslate">
&lt;igOB:XamWebOutlookBar x:Name=&quot;sidebarOutlookBar&quot; 
        MinimizedWidth=&quot;35&quot; AllowMinimized=&quot;True&quot; 
        NavigationPaneMinimized=&quot;sidebarOutlookBar_NavigationPaneMinimized&quot;
        NavigationPaneExpanding=&quot;sidebarOutlookBar_NavigationPaneExpanding&quot;
        VerticalAlignment=&quot;Stretch&quot; HorizontalAlignment=&quot;Stretch&quot;
        GroupsSource=&quot;{Binding Screens}&quot;&gt;
    &lt;igOB:XamWebOutlookBar.GroupContentTemplate&gt;
        &lt;DataTemplate&gt;
            &lt;ContentControl cal:View.Model=&quot;{Binding}&quot; /&gt;
        &lt;/DataTemplate&gt;
    &lt;/igOB:XamWebOutlookBar.GroupContentTemplate&gt;
    &lt;igOB:XamWebOutlookBar.GroupHeaderTemplate&gt;
        &lt;DataTemplate&gt;
            &lt;TextBlock Text=&quot;{Binding DisplayName}&quot; /&gt;
        &lt;/DataTemplate&gt;
    &lt;/igOB:XamWebOutlookBar.GroupHeaderTemplate&gt;
    &lt;igOB:XamWebOutlookBar.DefaultLargeIconTemplate&gt;
        &lt;DataTemplate&gt;
            &lt;Image Source=&quot;{Binding Icon, Converter={StaticResource stringToImageSourceConverter}}&quot;/&gt;
        &lt;/DataTemplate&gt;
    &lt;/igOB:XamWebOutlookBar.DefaultLargeIconTemplate&gt;
    &lt;igOB:XamWebOutlookBar.DefaultSmallIconTemplate&gt;
        &lt;DataTemplate&gt;
            &lt;Image Source=&quot;{Binding Icon, Converter={StaticResource stringToImageSourceConverter}}&quot;/&gt;
        &lt;/DataTemplate&gt;
    &lt;/igOB:XamWebOutlookBar.DefaultSmallIconTemplate&gt;
&lt;/igOB:XamWebOutlookBar&gt;
</pre>
<p>Notice the GroupsSource property is bound to the Screens property that the ViewModel inherits from its base class.  The ContentControl for each group is set to the ViewModel representing the group.  The group header is bound to the DisplayName property and the small and large icons are set to the Icon property.</p>
<p>The Message property is bound in the View for the group content:</p>
<pre class="brush: xml; gutter: false; title: ; notranslate">
&lt;UserControl x:Class=&quot;InfragisticsCaliburn.Views.ContentAView&quot;
    xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
    xmlns:xhttp://schemas.microsoft.com/winfx/2006/xaml
    xmlns:d=http://schemas.microsoft.com/expression/blend/2008
    xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006
    mc:Ignorable=&quot;d&quot;
    d:DesignHeight=&quot;300&quot; d:DesignWidth=&quot;400&quot;&gt;
    &lt;Grid x:Name=&quot;LayoutRoot&quot; Background=&quot;White&quot;&gt;
        &lt;TextBlock x:Name =&quot;Message&quot;/&gt;
    &lt;/Grid&gt;
&lt;/UserControl&gt;
</pre>
<p>Download the source of the project <a href="http://www.shazaml.com/downloads/InfragisticsCaliburn2.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shazaml.com/archives/infragistics-xamweboutlookbar-caliburn/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Caliburn Book: Chapters 1-3</title>
		<link>http://www.shazaml.com/archives/caliburn-book-chapters-1-3</link>
		<comments>http://www.shazaml.com/archives/caliburn-book-chapters-1-3#comments</comments>
		<pubDate>Mon, 07 Jun 2010 19:37:25 +0000</pubDate>
		<dc:creator>Mark Tucker</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Caliburn]]></category>
		<category><![CDATA[MVVM]]></category>

		<guid isPermaLink="false">http://www.shazaml.com/?p=545</guid>
		<description><![CDATA[Draft chapters from Caliburn book]]></description>
			<content:encoded><![CDATA[<p>Many months ago I put learning about the Caliburn framework on my “to do” list.  A few weeks ago I started the task and decided to write a book about it.  I don’t think that I am expert enough at the framework to actually publish a book.  Not yet anyway.  But I figured if I could grok it well enough to write about it that I would be well on my way to learning the framework. </p>
<p>You can download the book from <a href="http://www.shazaml.com/downloads/CaliburnBook.zip">here</a>.</p>
<p>The first chapter is a simple introduction to Caliburn.  Chapter 2 walks you through a simple, Hello Caliburn, application.  Chapter 3 is more ambitious and walks you through various aspects of the framework using the Silverlight GameLibrary sample.  It covers the same topics that Rob Eisenberg covered in his MIX10 talk.  There is also an Appendix included that lists some of the conventions found in Caliburn.</p>
<p>If I decide to write additional chapters, then I would include:</p>
<ul>
<li>Adding to Conventions</li>
<li>Overriding Conventions</li>
<li>TDD and Caliburn</li>
<li>Caliburn extensibility points</li>
<li>IResult implementations</li>
<li>Coroutines in more depth</li>
<li>UI patterns besides MVVM</li>
</ul>
<p>There is likely much more to Caliburn that I don’t even know what I don’t know yet.</p>
<p>Please reply with any feedback, corrections, further explanations, or additional chapter ideas.</p>
<p>If a book is ever published about Caliburn, Rob should be the one to do it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shazaml.com/archives/caliburn-book-chapters-1-3/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

