<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" version="2.0"><channel><title>.NET &amp; Funky Fresh</title><link>http://devlicio.us/blogs/rob_eisenberg/default.aspx</link><description>Check out the &lt;a href="http://www.amazon.com/gp/product/0672329859?&amp;amp;camp=212361&amp;amp;linkCode=wey&amp;amp;tag=bluspiconinc-20&amp;amp;creative=380733"&gt;WPF book&lt;/a&gt; &lt;a href="http://devlicio.us/blogs/christopher_bennage/default.aspx"&gt;CB&lt;/a&gt; and I authored!</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/FunkyFresh" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><title>MVVM Study Part 4: Naked WPF</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2009/11/13/mvvm-study-part-4-naked-wpf.aspx</link><pubDate>Fri, 13 Nov 2009 15:47:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:53709</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=53709</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2009/11/13/mvvm-study-part-4-naked-wpf.aspx#comments</comments><description>&lt;p&gt;I&amp;rsquo;ve &lt;a href="http://www.caliburnproject.org/"&gt;blogged previously&lt;/a&gt; about the MVVM pattern, but so far I have managed to escape without showing any code ;)&amp;nbsp; Before diving in deeper, I would like to stop and show what it takes to do a very simple implementation of this pattern on top of naked WPF (that&amp;rsquo;s plain WPF without any &lt;a href="http://www.caliburnproject.org/"&gt;cool frameworks&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;After all my praise of MVVM and how well matched it is with WPF/Silverlight, you might be surprised to hear me suggest that it&amp;rsquo;s not possible to implement without building a little infrastructure first.&amp;nbsp; It&amp;rsquo;s true.&amp;nbsp; But, we really only need to create one class:&lt;/p&gt;
&lt;pre name="code" class="c#"&gt;public class DelegateCommand : ICommand
{
    private readonly Action _execute;
    private readonly Func&amp;lt;bool&amp;gt; _canExecute;

    public DelegateCommand(Action execute)
        : this(execute, () =&amp;gt; true)
    {
        _execute = execute;
    }

    public DelegateCommand(Action execute, Func&amp;lt;bool&amp;gt; canExecute)
    {
        _execute = execute;
        _canExecute = canExecute;
    }

    public void Execute(object parameter)
    {
        _execute();
    }

    public bool CanExecute(object parameter)
    {
        return _canExecute();
    }

    public event EventHandler CanExecuteChanged
    {
        add { CommandManager.RequerySuggested += value; }
        remove { CommandManager.RequerySuggested -= value; }
    }
}&lt;/pre&gt;
&lt;p&gt;The &lt;em&gt;DelegateCommand&lt;/em&gt; is a common solution which allows us to adapt WPF controls, which accept an implementation of ICommand, to our ViewModel, which has simple properties and methods.&amp;nbsp; (If you want to make this work in Silverlight 3.0, you are going to have to build &lt;a href="http://blogs.southworks.net/jdominguez/2008/08/icommand-for-silverlight-with-attached-behaviors/"&gt;a little more infrastructure&lt;/a&gt;.)&amp;nbsp; Here&amp;rsquo;s an example of how you would use it as part of a fictitious employee creation screen:&lt;/p&gt;
&lt;pre name="code" class="c#"&gt;public class CreateEmployeeViewModel : INotifyPropertyChanged
{
    private string _firstName;
    private string _lastName;

    public CreateEmployeeViewModel()
    {
        SaveCommand = new DelegateCommand(Save, () =&amp;gt; CanSave);
    }

    public string FirstName
    {
        get { return _firstName; }
        set
        {
            _firstName = value; 
            NotifyOfPropertyChange(&amp;quot;FirstName&amp;quot;);
        }
    }

    public string LastName
    {
        get { return _lastName; }
        set
        {
            _lastName = value; 
            NotifyOfPropertyChange(&amp;quot;LastName&amp;quot;);
        }
    }

    public ICommand SaveCommand { get; private set;}

    public bool CanSave
    {
        get { return !string.IsNullOrEmpty(FirstName) &amp;amp;&amp;amp; !string.IsNullOrEmpty(LastName); }
    }

    public void Save()
    {
        MessageBox.Show(&amp;quot;Saved.&amp;quot;);
    }

    public event PropertyChangedEventHandler PropertyChanged = delegate { };

    public void NotifyOfPropertyChange(string propertyName)
    {
        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }
}&lt;/pre&gt;
&lt;p&gt;The SaveCommand property allows us to use normal data binding in our view:&lt;/p&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;Window x:Class=&amp;quot;MVVMStudy.PartFour.CreateEmployeeView&amp;quot;
        xmlns=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;
        xmlns:x=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;
        SizeToContent=&amp;quot;Height&amp;quot;
        Width=&amp;quot;400&amp;quot;&amp;gt;
    &amp;lt;Grid Margin=&amp;quot;4&amp;quot;&amp;gt;
        &amp;lt;Grid.ColumnDefinitions&amp;gt;
            &amp;lt;ColumnDefinition Width=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;ColumnDefinition Width=&amp;quot;*&amp;quot; /&amp;gt;
        &amp;lt;/Grid.ColumnDefinitions&amp;gt;
        &amp;lt;Grid.RowDefinitions&amp;gt;
            &amp;lt;RowDefinition Height=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;RowDefinition Height=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;RowDefinition Height=&amp;quot;Auto&amp;quot; /&amp;gt;
        &amp;lt;/Grid.RowDefinitions&amp;gt;
        
        &amp;lt;Label&amp;gt;First Name:&amp;lt;/Label&amp;gt;
        &amp;lt;TextBox Text=&amp;quot;{Binding FirstName}&amp;quot; 
                 Grid.Column=&amp;quot;1&amp;quot;/&amp;gt;
        
        &amp;lt;Label Grid.Row=&amp;quot;1&amp;quot;&amp;gt;Last Name:&amp;lt;/Label&amp;gt;
        &amp;lt;TextBox Text=&amp;quot;{Binding LastName}&amp;quot; 
                 Grid.Row=&amp;quot;1&amp;quot;
                 Grid.Column=&amp;quot;1&amp;quot;/&amp;gt;
        
        &amp;lt;Button Content=&amp;quot;Save&amp;quot;
                Command=&amp;quot;{Binding SaveCommand}&amp;quot;
                HorizontalAlignment=&amp;quot;Right&amp;quot; 
                Margin=&amp;quot;0 4 0 0&amp;quot;
                Grid.Row=&amp;quot;2&amp;quot;
                Grid.ColumnSpan=&amp;quot;2&amp;quot;/&amp;gt;
    &amp;lt;/Grid&amp;gt;
&amp;lt;/Window&amp;gt;&lt;/pre&gt;
&lt;p&gt;And in our code behind:&lt;/p&gt;
&lt;pre name="code" class="c#"&gt;public partial class CreateEmployeeView : Window
{
    public CreateEmployeeView()
    {
        InitializeComponent();
        DataContext = new CreateEmployeeViewModel();
    }
}&lt;/pre&gt;
&lt;p&gt;Now you know a little more concretely what a WPF/SL dev means when they reference MVVM (Actually, all I have shown here is VVM.&amp;nbsp; Presumably you have a real employee model that you are saving in the save method or a web service you are calling.&amp;nbsp; That&amp;rsquo;s the missing M and isn&amp;rsquo;t really the focus of this series.)&amp;nbsp; But even then, this doesn&amp;rsquo;t get you very far.&amp;nbsp; If you are like me, you probably have a lot of questions still.&amp;nbsp; You might we wondering:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;What happens if I have a complex View Model with lots of properties and actions? &lt;/li&gt;
&lt;li&gt;How do I organize my View Models and Views? &lt;/li&gt;
&lt;li&gt;How do I pass contextual data to a View Model? &lt;/li&gt;
&lt;li&gt;Who creates View Models and associates them with the proper View? &lt;/li&gt;
&lt;li&gt;Do I really have to host instances of DelegateCommand on my View Model? &lt;/li&gt;
&lt;li&gt;How would I allow the user to work with multiple employees at the same time? &lt;/li&gt;
&lt;li&gt;How do I prevent unsaved changes from being accidentally lost? &lt;/li&gt;
&lt;li&gt;How do I handle dialogs? &lt;/li&gt;
&lt;li&gt;How do I manage contextual menus and toolbars? &lt;/li&gt;
&lt;li&gt;How long is this series going to go on? &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;We&amp;rsquo;ll take a look at answers to some of these questions in future posts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=53709" width="1" height="1"&gt;</description><enclosure url="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.00.05.37.09/MVVMStudy.PartFour.zip" length="14941" type="application/x-zip-compressed" /><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF/default.aspx">WPF</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Xaml/default.aspx">Xaml</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/databinding/default.aspx">databinding</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/.NET+3.5/default.aspx">.NET 3.5</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/MVVM/default.aspx">MVVM</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/UI+Architecture/default.aspx">UI Architecture</category></item><item><title>A Follow-up to my Azure Panic Attack</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2009/11/08/a-follow-up-to-my-azure-panic-attack.aspx</link><pubDate>Sun, 08 Nov 2009 21:25:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:53525</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=53525</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2009/11/08/a-follow-up-to-my-azure-panic-attack.aspx#comments</comments><description>&lt;p&gt;In &lt;a href="http://devlicio.us/blogs/rob_eisenberg/archive/2009/11/02/microsoft-what-is-the-meaning-of-this.aspx"&gt;this post&lt;/a&gt;, I panicked a bit about an email I received from The Azure Team ;)&amp;nbsp; In short, the email said that my storage account was going to be deleted on November 3rd if I didn&amp;rsquo;t migrate it to the new servers.&amp;nbsp; I received the email around 6pm on November 2nd.&amp;nbsp; Yikes! I feared that we might lose all of &lt;a href="http://www.silverarcade.com/"&gt;Silver Arcade&amp;rsquo;s&lt;/a&gt; assets.&amp;nbsp; After a bit of research, I discovered that I should have received a similar email warning me about this change several months ago. Something went wrong somewhere, somehow. In any case, I managed to get all of our data backed up using &lt;a href="http://www.cerebrata.com/Products.aspx"&gt;Cloud Storage Studio&lt;/a&gt; which &lt;a href="http://blogs.silverarcade.com/silverlight-games-101/"&gt;Bill Reiss&lt;/a&gt; had recommended to me.&amp;nbsp; While I was doing this, I was frantically trying to get into contact with someone from the Azure team. I emailed &lt;a href="http://blog.smarx.com/"&gt;Steve Marx&lt;/a&gt;. He responded quickly and had a plan of action. We had a short email exchange and within a couple hours I was in contact with the right people. The Azure Team to the rescue! Once the team was made aware of my situation, they offered to migrate my data for me. Awesome! While I started out the evening in a bit of a panic, the Azure team restored my confidence. They treated me well and met my needs with excellence. Thanks for being committed to your customers!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=53525" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Azure/default.aspx">Azure</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Cloud+Computing/default.aspx">Cloud Computing</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Silver+Arcade/default.aspx">Silver Arcade</category></item><item><title>Microsoft, what is the meaning of this?</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2009/11/02/microsoft-what-is-the-meaning-of-this.aspx</link><pubDate>Tue, 03 Nov 2009 00:01:21 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:53336</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>3</slash:comments><wfw:commentRss>http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=53336</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2009/11/02/microsoft-what-is-the-meaning-of-this.aspx#comments</comments><description>&lt;p&gt;I just received this email on November 2nd at 6pm.&amp;#160; I hadn’t heard a word of this prior.&amp;#160; Thanks for the warning…&lt;/p&gt;  &lt;p&gt;Windows Azure CTP participant,&lt;/p&gt;  &lt;p&gt;You are receiving this mail because you have an application or storage account in Windows Azure in the “USA - Northwest” region.&amp;#160; Windows Azure production applications and storage will no longer be supported in the ‘USA-Northwest’ region.&amp;#160; We will be deleting all Windows Azure applications and storage accounts in the “USA - Northwest” region on November 3rd.&lt;/p&gt;  &lt;p&gt;To move your application/storage, first delete the project using the “Delete Service” button.&amp;#160; Then recreate it, choosing the “USA - Southwest” region.&amp;#160; (It may take a few minutes for your previous application and storage account names to become available again.)&lt;/p&gt;  &lt;p&gt;&lt;img src="http://sn129w.snt129.mail.live.com/mail/SafeRedirect.aspx?hm__tg=http://65.55.72.103/att/GetAttachment.aspx&amp;amp;hm__qs=file%3da56c5363-e523-49ca-bfd9-d91751b0904d.png%26ct%3daW1hZ2UvcG5n%26name%3daW1hZ2UwMDEucG5n%26inline%3d1%26rfc%3d0%26empty%3dFalse%26imgsrc%3dcid%253aimage001.png%254001CA5BCE.CB2AA280&amp;amp;oneredir=1&amp;amp;ip=10.13.130.8&amp;amp;d=d3873&amp;amp;mf=0&amp;amp;a=01_8025b7aca3a51f26de9526725af9bcd106dcd43fa8ef566cf0d28def93d856fc" width="400" height="176" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Note that deleting your storage account will destroy all of the data stored in that account.&lt;/b&gt;&amp;#160; Copy any data you wish to preserve first.&lt;/p&gt;  &lt;p&gt;If you would like help migrating your project or have any other concerns, please reply to this mail.&lt;/p&gt;  &lt;p&gt;- The Windows Azure Team&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=53336" width="1" height="1"&gt;</description></item><item><title>NHProf and Caliburn Testability</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2009/10/30/nhprof-and-caliburn-testability.aspx</link><pubDate>Fri, 30 Oct 2009 19:07:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:53240</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=53240</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2009/10/30/nhprof-and-caliburn-testability.aspx#comments</comments><description>&lt;p&gt;I&amp;rsquo;ve heard some developers asking about UI testing lately.&amp;nbsp; Specifically, there have been some questions about what we did with NHProf.&amp;nbsp; So, I thought I would write a little bit about that here.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;There are a variety of different types of tests you can do.&amp;nbsp; In my experience some have a better ROI than others.&amp;nbsp; For example, we don&amp;rsquo;t do any UI testing with automation APIs.&amp;nbsp; Those are pretty painful, brittle tests to write and we haven&amp;rsquo;t worked in scenarios where they would really help us.&amp;nbsp; The two main types of UI testing we tend to do are Unit Tests of the View Model and Binding Validation Tests against the Views.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;View Model Tests&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;There are many advantages in taking a View Model approach to building your UI.&amp;nbsp; When we build VMs we try and push as much of the UI state into our models as possible.&amp;nbsp; By doing this we &amp;ldquo;virtualize&amp;rdquo; our entire UI, allowing us to simulate a large percentage of the UI behavior without ever opening a Window or showing anything on screen.&amp;nbsp; This is great for testability.&amp;nbsp; It means, we can use simple state based unit tests to verify the behavior of our UI.&amp;nbsp; Here&amp;rsquo;s a simple example from NHProf:&lt;/p&gt;
&lt;pre name="code" class="c#"&gt;public class StatementFilterTestFixture
{
    private readonly FilterServiceModel service;
    private readonly IList&amp;lt;IStatementSnapshot&amp;gt; statements;

    public StatementFilterTestFixture()
    {
        statements = new List&amp;lt;IStatementSnapshot&amp;gt;
                         {
                             create_a_statement(100, &amp;quot;hello&amp;quot;),
                             create_a_statement(200, &amp;quot;select * from something&amp;quot;),
                             create_a_statement(300, &amp;quot;select field1 from something&amp;quot;),
                             create_a_statement(400, &amp;quot;select monkey,ninja,pirate,robot from floating_island&amp;quot;),
                             create_a_statement(500, &amp;quot;&amp;quot;),
                         };

        service = new FilterServiceModel();
    }

    [Fact]
    public void Can_filter_by_both_duration_for_values_less_than_300_and_contains_text()
    {
        var filters = new ObservableCollection&amp;lt;IFilter&amp;gt;
                          {
                              new FilterByDuration
                              {
                                  Operator = ExpressionType.LessThan, 
                                Value = &amp;quot;300&amp;quot;
                              },
                              new FilterBySqlContains {Text = &amp;quot;something&amp;quot;}
                          };

        service.Filters = filters;

        Assert.Equal(1, statements.Where(x =&amp;gt; service.FilterStatement(x)).Count());
    }
}&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Binding Validation Tests&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;While the WPF/SL data binding mechanism opens the door to building rich View Models, it also introduces a new problem: potential binding expression errors.&amp;nbsp; Because we didn&amp;rsquo;t want to give up the productivity benefits of databinding and View Models, we chose to take some time to build a binding validation framework.&amp;nbsp; We then write simple tests to insure that there are no typos or silly mistakes in our binding expressions.&amp;nbsp; Here&amp;rsquo;s an example test from NHProf:&lt;/p&gt;
&lt;pre name="code" class="c#"&gt;public class StatisticsDetailsTestFixture : ViewTestFixtureBase
{
    private readonly ValidationResult&amp;lt;StatisticsModel&amp;gt; bindings;

    public StatisticsDetailsTestFixture()
    {
        bindings = Validator.For&amp;lt;StatisticDetailsView, StatisticsModel&amp;gt;()
            .Validate();
    }

    [Fact]
    public void BindingsDoNotHaveErrors()
    {
        Assert.False(bindings.HasErrors, bindings.ErrorSummary);
    }

    [Fact]
    public void NameIsBound()
    {
        Assert.True(bindings.WasBoundTo(x =&amp;gt; x.DisplayName));
    }

    [Fact]
    public void StatisticsAreBound()
    {
        Assert.True(bindings.WasBoundTo(x =&amp;gt; x.SortedStatistics));
    }
}&lt;/pre&gt;
&lt;p&gt;You can actually take this one step farther as &lt;a href="http://nhforge.org/blogs/nhibernate/archive/2009/08/19/nhibernate-and-wpf-viewmodels-and-views.aspx"&gt;Jos&amp;eacute; Romaniello&lt;/a&gt; has in testing his Chinook Media Manager.&amp;nbsp; Take a look at &lt;a href="http://code.google.com/p/unhaddins/source/browse/trunk/Examples/uNHAddIns.Examples.WPF/ChinookMediaManager.View.Test/TestDataBindings.cs"&gt;this sweet piece of code&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=53240" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF/default.aspx">WPF</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/databinding/default.aspx">databinding</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/.NET+3.5/default.aspx">.NET 3.5</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Caliburn/default.aspx">Caliburn</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/MVVM/default.aspx">MVVM</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/UI+Architecture/default.aspx">UI Architecture</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/NHProf/default.aspx">NHProf</category></item><item><title>Caliburn v1 RTW for WPF, Silverlight 2.0 and 3.0!</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2009/10/26/caliburn-v1-rtw-for-wpf-silverlight-2-0-and-3-0.aspx</link><pubDate>Mon, 26 Oct 2009 17:06:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:53139</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>9</slash:comments><wfw:commentRss>http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=53139</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2009/10/26/caliburn-v1-rtw-for-wpf-silverlight-2-0-and-3-0.aspx#comments</comments><description>&lt;p&gt;Hooray!!! I finally &lt;a href="http://caliburn.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=34985"&gt;released Caliburn v1 to RTW&lt;/a&gt; and got &lt;a href="http://www.caliburnproject.org/"&gt;the official site launched&lt;/a&gt;! This has been a long time coming and I could not have done it without the generous help and support of the .NET community, family and friends.&amp;nbsp; Many individuals contributed by finding bugs, submitting patches, recommending features or improvements and providing general support and encouragement.&amp;nbsp; I would like to call out a few special individuals (in no particular order) who contributed significantly:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Michael Davis &amp;ndash; For submitting numerous bug fixes and patches. &lt;/li&gt;
&lt;li&gt;&lt;a href="http://devlicio.us/controlpanel/blogs/posteditor.aspx/rauhski.blogspot.com"&gt;Ryan Rauh&lt;/a&gt; &amp;ndash; For creating the fabulous Prism integration module, which I believe makes &lt;a href="http://compositewpf.codeplex.com/"&gt;Prism&lt;/a&gt; easier to use with Caliburn than without! &lt;/li&gt;
&lt;li&gt;&lt;a href="http://marcoamendola.wordpress.com/"&gt;Marco Amendola&lt;/a&gt; &amp;ndash; For implementing several new features, fixing tons of bugs, submitting patches, writing demos and being an awesome help answering questions on the forums! &lt;/li&gt;
&lt;li&gt;&lt;a href="http://devlicio.us/blogs/christopher_bennage/default.aspx"&gt;Christopher Bennage&lt;/a&gt; &amp;ndash; For fixing bugs, inventing and inspiring cool features, participating in the forums, believing in my vision and being willing to put this framework to the test on every WPF/SL application our company has built for the last several years. &lt;/li&gt;
&lt;li&gt;Anna Eisenberg &amp;ndash; It goes without saying that my wife has been very gracious to me.&amp;nbsp; She has supported and believed in me and my work without faltering.&amp;nbsp; I love you! &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I would also like to thank the codeplex users MichaelDBang, Bezieur, p_matyjasek and davidpadbury for their patches and participation in the forums.&amp;nbsp; And, as always, if I left someone out, I sincerely apologize.&amp;nbsp; (I&amp;rsquo;m going to do a better job of tracking this stuff for v2&amp;hellip;)&lt;/p&gt;
&lt;p&gt;In addition to &lt;a href="http://caliburn.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=34985"&gt;the release build&lt;/a&gt; and &lt;a href="http://www.caliburnproject.org/"&gt;the official site&lt;/a&gt;, we&amp;rsquo;ve added a gallery of &lt;a href="http://caliburn.codeplex.com/wikipage?title=Products&amp;amp;referringTitle=Documentation"&gt;applications&lt;/a&gt; and &lt;a href="http://caliburn.codeplex.com/wikipage?title=BlogsArticlesProjects&amp;amp;referringTitle=Documentation"&gt;related projects&lt;/a&gt; to our &lt;a href="http://caliburn.codeplex.com/documentation"&gt;new documentation&lt;/a&gt;.&amp;nbsp; In the coming months I am going to be extending this documentation with additional articles in my &lt;a href="http://www.caliburnproject.org/"&gt;MVVM series&lt;/a&gt; as well as some cool tutorials.&lt;/p&gt;
&lt;p&gt;For those of you who have never heard of Caliburn, it is a UI framework designed to aid in the development of WPF and Silverlight applications. Caliburn implements a variety of UI patterns for solving real-world problems. Patterns that are enabled by the framework include MVC, MVP, Presentation Model (MVVM), Commands and Application Controller.&amp;nbsp; Here&amp;rsquo;s a bullet point list of what Caliburn gives you that you don&amp;rsquo;t get from WPF/SL out of the box:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Extends databinding to methods, making MVVM architectures simple and intuitive. &lt;/li&gt;
&lt;li&gt;Adds pre/post execution filters and rescues to MVVM actions. &lt;/li&gt;
&lt;li&gt;Simplifies asynchronous programming through a powerful implementation of Coroutines. &lt;/li&gt;
&lt;li&gt;Provides base classes supporting common UI roles such as Screen Activator, Screen Conductor, Screen Collection and Application Controller. &lt;/li&gt;
&lt;li&gt;Encourages a convention over configuration approach to architecting solutions. &lt;/li&gt;
&lt;li&gt;Supports TDD by providing a powerful databinding validation framework for WPF. &lt;/li&gt;
&lt;li&gt;Enables use of the same API for WPF and Silverlight architectures &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Here&amp;rsquo;s a more detailed explanation of its key features:&lt;/p&gt;
&lt;h5&gt;Actions&lt;/h5&gt;
&lt;p&gt; Actions extend the databinding capabilities of WPF/SL by enabling a UI to bind not only to data but to methods as well. Caliburn provides a consistent API for wiring events, gestures, and attached events to methods on a presentation-related class. This type of method binding removes much of the glue code involved in building an &lt;a href="http://en.wikipedia.org/wiki/Model_View_Presenter"&gt;MVP&lt;/a&gt; or &lt;a href="http://martinfowler.com/eaaDev/PresentationModel.html"&gt;Presentation Model&lt;/a&gt; (MVVM) architecture. In addition to basic execution of methods, Caliburn&amp;#39;s action mechanism can pass data from the UI into the methods as parameters and bind return values back to the UI. A filter mechanism (similar to ASP.NET MVC) exists for decorating methods. Filters can affect the availability of a given action through the UI, which can be represented by automatically disabling, hiding or collapsing controls. Caliburn can also automatically execute methods asynchronously, and execute callbacks. It does all the thread marshalling for you. If that&amp;#39;s not enough power, you can take advantage of Caliburn&amp;#39;s Coroutine implementation through actions as well.   &lt;/p&gt;
&lt;h5&gt;Commands&lt;/h5&gt;
&lt;p&gt; Caliburn&amp;#39;s command implementation is an alternative to WPF&amp;#39;s and supplies very useful functionality that is altogether missing from Silverlight. As you might expect, it is an implementation of the &lt;a href="http://en.wikipedia.org/wiki/Command_pattern"&gt;Command Pattern.&lt;/a&gt;. Commands are built on top of Actions and thus share many of the same features, including multiple input parameters, filters and automatic asynchronous execution. Additionally, commands can be created in hierarchies, such that a parent command can execute multiple child commands. The parent command&amp;#39;s availability can also be affected by its children in various ways. There are two types of composite commands available out of the box, but the mechanism is extensible.   &lt;/p&gt;
&lt;h5&gt;Application Model&lt;/h5&gt;
&lt;p&gt; Caliburn supports UI architectures based on MVP and MVVM through its various implementations of the IPresenter interface. Often times, these types of architectures involve tricky UI lifecycle issues such as handling activation, deactivation and shutdown semantics for various UI components. The basic logic for handling these scenarios is found in Caliburn&amp;rsquo;s Presenter, PresenterManager, MultiPresenter, MultiPresenterManager and Navigator classes. By composing these classes you can create a hierarchical model representing the entire runtime state of your application. In Silverlight, you can even use the browser as an Application Controller with Caliburn&amp;rsquo;s support for deep linking. By using these classes as a starting point, you can very quickly get up in running with an MVP or MVVM architecture.   &lt;/p&gt;
&lt;h5&gt;Conventions&lt;/h5&gt;
&lt;p&gt; Convention over configuration is a way to leverage a great deal of a framework&amp;#39;s power without having to go through tons of tedious configuration or setup code. Caliburn has basic conventions around view discovery, binding of actions and building-up of hierarchical View Models. These are all implemented through well-known services which are easily replaceable or extendable with your own conventions.   &lt;/p&gt;
&lt;h5&gt;Testability&lt;/h5&gt;
&lt;p&gt; One of the goals of Caliburn is to make it easier to build applications right. To this effect, Caliburn has features geared around &lt;a href="http://en.wikipedia.org/wiki/Unit_test"&gt;unit testing&lt;/a&gt;. There is currently rich support for testing databindings in WPF and a simple fluent interface for verifying change notification on model objects. Unit tests for view bindings give the developer the confidence they need to refactor their models, knowing that they will be aware of broken bindings before they run the application. Not only will they be aware that the bindings are broken, but Caliburn&amp;rsquo;s binding validator will tell you exactly where the problem is in the UI hierarchy and what the specific error was.   &lt;/p&gt;
&lt;h5&gt;Utilities&lt;/h5&gt;
&lt;p&gt;Various utility classes and extension methods are provided as part of Caliburn. The most popular of which is the Execute static class, which enables a developer to easily execute code on a background thread or on the UI thread.&lt;/p&gt;
&lt;p&gt;Caliburn has come a long was since I first started working on it about three years ago and we are not finished yet.&amp;nbsp; I&amp;rsquo;ve got a host of ideas for v2 and now is a great time to get started.&amp;nbsp; &lt;a href="http://caliburn.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=34985"&gt;Download the framework&lt;/a&gt;.&amp;nbsp; Start using it to build UI&amp;rsquo;s, give me feedback and help us make it even better in v2!&lt;/p&gt;
&lt;p&gt;With Much Gratitude (and hoping this makes your work a little easier),&lt;/p&gt;
&lt;p&gt;Rob Eisenberg&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=53139" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF/default.aspx">WPF</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Xaml/default.aspx">Xaml</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/databinding/default.aspx">databinding</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF_2F00_e/default.aspx">WPF/e</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/.NET+3.5/default.aspx">.NET 3.5</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Caliburn/default.aspx">Caliburn</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Featured/default.aspx">Featured</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/DSL/default.aspx">DSL</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/RIA/default.aspx">RIA</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/MVVM/default.aspx">MVVM</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/UI+Architecture/default.aspx">UI Architecture</category></item><item><title>Caliburn RC3</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2009/09/10/caliburn-rc3.aspx</link><pubDate>Thu, 10 Sep 2009 19:42:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:51196</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=51196</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2009/09/10/caliburn-rc3.aspx#comments</comments><description>&lt;p&gt;Today I&amp;rsquo;ve made the &lt;a href="http://caliburn.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=32809"&gt;RC3 of Caliburn v1&lt;/a&gt; available.&amp;nbsp; I&amp;rsquo;m going to let it sit for a couple of weeks, then I will RTW.&amp;nbsp; Please take time to update your code to this new version and post any bugs to &lt;a href="http://caliburn.codeplex.com/"&gt;the codeplex site&lt;/a&gt;.&amp;nbsp; Any bugs not found in the next couple of weeks will have to be fixed in v2.&amp;nbsp; Below is a list of changes/fixes between RC2 and RC3.&amp;nbsp; You can also take a look at the recently extended &lt;a href="http://caliburn.codeplex.com/Wiki/View.aspx?title=Table%20Of%20Contents"&gt;documentation online.&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Updated the StructureMap.dll to version 2.5.3. &lt;/li&gt;
&lt;li&gt;Made a slight alteration to CoreConfiguration that makes it more friendly when run in a unit test. &lt;/li&gt;
&lt;li&gt;Added an AutofacAdapter for .NET 3.5, Silverlight 2.0 and Silverlight 3.0. &lt;/li&gt;
&lt;li&gt;Fixed bugs in the DefaultWindowManager. &lt;/li&gt;
&lt;li&gt;Added IPresenterNode which allows presenters to be hooked up with a reference to their parent. All implementors of IPresenterHost now wire themselves when opening children and unwire themselves during a shutdown. &lt;/li&gt;
&lt;li&gt;Created the IBinder interface. This replaces the functionality that was in the extension method AttachTo. This interface is meant to provide a pluggable way to change the behavior of Model/View wire-up. &lt;/li&gt;
&lt;li&gt;Updated DefaultBinder to allow for convention-based action wire-up. &lt;/li&gt;
&lt;li&gt;Fixed a bug in auto-registration with CommandAttribute. &lt;/li&gt;
&lt;li&gt;Fixed several bugs with CaliburnApplication &lt;/li&gt;
&lt;li&gt;Fixed a bug where certain module scenarios would cause the PresentationFrameworkModule to be configured twice. &lt;/li&gt;
&lt;li&gt;Fixed some inconsistencies in the DefaultWindowManager and CaliburnApplication.silverlight.cs. &lt;/li&gt;
&lt;li&gt;Removed a pesky attribute in the WPF ContactManager&amp;#39;s .config file that was causing bugs for some people. &lt;/li&gt;
&lt;li&gt;Removed Message.Attach2nd, Message.Attach3rd and Message.Attach4th. You can now attach an arbitrary number of messages with Message.Attach by separating each message with a semicolon. This caused a breaking change to the IParser implementation, but it is unlikely that will affect many people. &lt;/li&gt;
&lt;li&gt;Fixed some bugs in Parameter.silverlight.cs related to event defaults for elements that are bound. &lt;/li&gt;
&lt;li&gt;Improved the BackgroundProcessing sample. &lt;/li&gt;
&lt;li&gt;Fixed some bugs in parsing of parameters for messages. There were certain scenarios where the parser could not differentiate between string literals and references to control.&amp;nbsp; To pass literals as a message parameter (short syntax only), you must surround it with single quotes. &lt;/li&gt;
&lt;li&gt;Added AttachedEventTriggerParser. We can all now use attached event triggers in the short syntax. Usage is as follows: cal:Message.Attach=&amp;quot;[AttachedEvent ButtonBase.Click] = [Action MyAction]&amp;quot; The caveat is that we cannot map namespaces from xaml into the parser. To work around this problem, we search through all AppDomain assemblies by default. If you would like to optimize this, simply inherit from AttachedEventTriggerParser and override GetSearchableAssemblies. Then register your ITriggerParser with IParser under the name &amp;quot;AttachedEvent&amp;quot; &lt;/li&gt;
&lt;li&gt;Enabled the DefaultViewStrategy to handle custom contexts without the need of a ViewStrategyAttribute. If a context is the DefaultViewStrategy will treat the view name as a folder name by adding an &amp;quot;s&amp;quot; and search that folder for views with the context as their name. &lt;/li&gt;
&lt;li&gt;Fixed various bugs in DefaultViewStrategy. &lt;/li&gt;
&lt;li&gt;Fixed various bugs in AsynchronousAction and in the BackgroundProcessing sample. &lt;/li&gt;
&lt;li&gt;Updated MEF to Preview 7. &lt;/li&gt;
&lt;li&gt;Changed IMessageBinder.BindOutcome to IMessageBinder.CreateResult. &lt;/li&gt;
&lt;li&gt;Enabled the DefaultBinder to look for properties named with the pattern Can + Action and wire up the IsEnabled property automatically. &lt;/li&gt;
&lt;li&gt;Fixed the signatures of extension methods for IWindowManager. &lt;/li&gt;
&lt;li&gt;Fixed a bug in binding validation that occurs when properties are overridden on a bound type. &lt;/li&gt;
&lt;li&gt;Provided a way for a presenter to pass a dialog result to the view on close. &lt;/li&gt;
&lt;li&gt;Made some improvements to exception messages in the case of parameter count mismatch during invocation. &lt;/li&gt;
&lt;li&gt;Updated Caliburn&amp;#39;s build to work with Silverlight 3.0.40818.0 service release. &lt;/li&gt;
&lt;li&gt;Extended the IDispatcher to allow async UI invocation. &lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=51196" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF/default.aspx">WPF</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Xaml/default.aspx">Xaml</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF_2F00_e/default.aspx">WPF/e</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/.NET+3.5/default.aspx">.NET 3.5</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Caliburn/default.aspx">Caliburn</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Featured/default.aspx">Featured</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/RIA/default.aspx">RIA</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/MVVM/default.aspx">MVVM</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/UI+Architecture/default.aspx">UI Architecture</category></item><item><title>Dispelling a Common WPF/SL Myth</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2009/09/08/dispelling-a-common-wpf-silverlight-myth.aspx</link><pubDate>Tue, 08 Sep 2009 16:13:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:51164</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>15</slash:comments><wfw:commentRss>http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=51164</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2009/09/08/dispelling-a-common-wpf-silverlight-myth.aspx#comments</comments><description>&lt;p&gt;Everywhere I look I find WPF/Silverlight developers who believe a very popular myth:&amp;nbsp; You cannot update a ViewModel or an ObservableCollection from a non-UI thread.&amp;nbsp; Like most myths, there is an element of truth here.&amp;nbsp; But not understanding that truth can lead you to some very elaborate solutions.&amp;nbsp; Here&amp;rsquo;s the truth: You cannot fire the change notification from a non-UI thread.&amp;nbsp; So with that in mind, it becomes very easy to abstract thread synchronization away.&amp;nbsp; Here&amp;rsquo;s how we do it in Caliburn:&lt;/p&gt;
&lt;pre name="code" class="c#"&gt;public abstract class PropertyChangedBase : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged = delegate { };

    public virtual void NotifyOfPropertyChange(string propertyName)
    {
        Execute.OnUIThread(() =&amp;gt; RaisePropertyChangedEventImmediately(propertyName));
    }

    public virtual void RaisePropertyChangedEventImmediately(string propertyName)
    {
        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }
}

public class BindableCollection&amp;lt;T&amp;gt; : ObservableCollection&amp;lt;T&amp;gt;, IObservableCollection&amp;lt;T&amp;gt;
{
    public BindableCollection() {}

    protected override void OnPropertyChanged(PropertyChangedEventArgs e)
    {
        Execute.OnUIThread(() =&amp;gt; RaisePropertyChangedEventImmediately(e));
    }

    protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
    {
        Execute.OnUIThread(() =&amp;gt; RaiseCollectionChangedEventImmediately(e));
    }

    public void RaiseCollectionChangedEventImmediately(NotifyCollectionChangedEventArgs e)
    {
        base.OnCollectionChanged(e);
    }

    public void RaisePropertyChangedEventImmediately(PropertyChangedEventArgs e)
    {
        base.OnPropertyChanged(e);
    }
}&lt;/pre&gt;
&lt;p&gt;The Execute.OnUIThread is a helper that Caliburn provides to abstract away the underlying IDispatcher.&amp;nbsp; When Caliburn&amp;rsquo;s dispatcher is asked to execute something on the UI thread it first checks the thread it is on.&amp;nbsp; If it is already on the UI thread, it simply invokes the delegate normally.&amp;nbsp; Otherwise it marshals the call to the UI thread.&amp;nbsp; This approach also makes testing easy, because you will never find any threading code in a ViewModel.&amp;nbsp; Everything ultimately goes through an IDispatcher which Caliburn provides a fake implementation of for testing purposes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=51164" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF/default.aspx">WPF</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF_2F00_e/default.aspx">WPF/e</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Caliburn/default.aspx">Caliburn</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/MVVM/default.aspx">MVVM</category></item><item><title>Tallahassee Code Camp is Upon Us!</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2009/09/04/tallahassee-code-camp-is-upon-us.aspx</link><pubDate>Fri, 04 Sep 2009 19:18:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:51140</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>4</slash:comments><wfw:commentRss>http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=51140</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2009/09/04/tallahassee-code-camp-is-upon-us.aspx#comments</comments><description>&lt;p&gt;Tomorrow at the FSU College of Communication and Information we will hold Tallahassee&amp;rsquo;s 5th Annual Code Camp!&amp;nbsp; We have a great &lt;a href="http://www.tallycodecamp.org/2009/Speaker/List"&gt;list of speakers&lt;/a&gt; and some &lt;a href="http://www.tallycodecamp.org/2009/Session/List"&gt;awesome sessions&lt;/a&gt; planned.&amp;nbsp; Please check out &lt;a href="http://www.tallycodecamp.org/2009"&gt;our official site.&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=51140" width="1" height="1"&gt;</description></item><item><title>MVVM Study Part 3 – Why?</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2009/09/01/mvvm-study-part-3-why.aspx</link><pubDate>Tue, 01 Sep 2009 20:39:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:51102</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>5</slash:comments><wfw:commentRss>http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=51102</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2009/09/01/mvvm-study-part-3-why.aspx#comments</comments><description>&lt;p&gt;There are several major architectural approaches used in building user interfaces.&amp;nbsp; MVC, MVP and MVVM seam to be the most popular of the bunch.&amp;nbsp; From among them, MVVM has risen to the top of the stack for WPF and Silverlight developers.&amp;nbsp; Even ignoring the question &amp;ldquo;Why use separated presentation at all?&amp;rdquo;* and asking &amp;ldquo;Why MVVM?&amp;rdquo; yields an answer with many facets.&amp;nbsp; In this post I&amp;rsquo;m mostly interested in in how MVVM exhibits &lt;em&gt;Conceptual Integrity&lt;/em&gt; with WPF/SL.&amp;nbsp; I believe that it is for this reason that most developers are using MVVM over another pattern.&amp;nbsp; For a very good discussion of some other aspects, have a read of &lt;a href="http://codebetter.com/blogs/glenn.block/archive/2009/08/02/the-spirit-of-mvvm-viewmodel-it-s-not-a-code-counting-exercise.aspx"&gt;Glenn&amp;rsquo;s recent post.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s how the book &lt;a href="http://www.amazon.com/Beautiful-Architecture-Leading-Thinkers-Software/dp/059651798X/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1251747214&amp;amp;sr=8-1"&gt;Beautiful Architecture&lt;/a&gt; describes &lt;em&gt;Conceptual Integrity:&lt;/em&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;Conceptual integrity comes from consistency in things like decomposition criteria, application of design patterns, and data formats.&amp;nbsp; This allows a developer to apply experience gained working in one part of the system to developing and maintaining other parts of the system.&amp;nbsp; The same rules apply throughout the system.&amp;rdquo;&amp;nbsp; &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Even if you haven&amp;rsquo;t pondered the concept of &lt;em&gt;Conceptual Integrity&lt;/em&gt; explicitly, you have more than likely &lt;em&gt;felt &lt;/em&gt;when it was not present in a given architecture.&amp;nbsp; I think this term describes well the sentiment held by developers switching from WebForms to ASP.NET MVC (or Rails for that matter).&amp;nbsp; WebForms does not exhibit &lt;em&gt;Conceptual Integrity&lt;/em&gt; in the context of the Web, while MVC does.&lt;/p&gt;
&lt;p&gt;Below are three WPF/SL concepts with which I think the MVVM pattern resonates well.&amp;nbsp; That is to say,&amp;nbsp; the MVVM pattern came to the forefront of UI design patterns for WPF/SL because it is consistent with the following core concepts of the platform:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Databinding&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;WPF and Silverlight have richer databinding support than has previously been available on the Windows platform (perhaps any platform).&amp;nbsp; If you talk to an experienced WPF developer, I would be surprised if he/she didn&amp;rsquo;t list this as one of the most, if not &lt;em&gt;the&lt;/em&gt; most important aspect of the framework.&amp;nbsp; It is what enables a developer to create a fairly pure model (the ViewModel) and then stick the View on top of it.&amp;nbsp; Databinding is the &amp;ldquo;adhesive&amp;rdquo; that allows us to get rid of the manual push/pull synchronization code that is required in an MVP design.&amp;nbsp; Indeed, the original &lt;a href="http://martinfowler.com/eaaDev/PresentationModel.html"&gt;PresentationModel&lt;/a&gt; pattern, arose in correlation with earlier databinding mechanisms.**&amp;nbsp; So, it&amp;rsquo;s not surprising that WPF&amp;rsquo;s super-charged databinding would bring this pattern to the forefront and give it &lt;a href="http://en.wikipedia.org/wiki/Abraham"&gt;a new name&lt;/a&gt;: ViewModel.&amp;nbsp; In short, databinding provides a consistent mechanism through which a developer can describe how a View and ViewModel will interact.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Templates&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If you look at the WPF/SL control architecture, you&amp;rsquo;ll notice something quite interesting:&amp;nbsp; A Control&amp;rsquo;s behavior and its View are separated.&amp;nbsp; The platform splits controls into two parts, the Control class (ViewModel) and the ControlTemplate (View).&amp;nbsp; Yes, one reason why MVVM makes sense is because the platform itself is architected in that way.&amp;nbsp; Recalling the previous point: How do you describe the interaction between the Control Class and the ControlTemplate? TemplateBinding.&amp;nbsp; Of coarse, you could venture to build your own MVVM architecture by creating your VMs as descendants of Control and then defining Views as ControlTemplates (please don&amp;rsquo;t do this).&amp;nbsp; But, there is a better way.&amp;nbsp; DataTemplates extend the same concept by allowing Views over any type of object.&amp;nbsp; And of coarse, Databinding is used to glue the object to the template.&amp;nbsp; So, you can imagine how &lt;a href="http://blogs.msdn.com/johngossman/archive/2005/10/08/478683.aspx"&gt;Gossman&amp;rsquo;s original description of MVVM&lt;/a&gt; was very intuitive for him even if &lt;a href="http://blogs.msdn.com/johngossman/archive/2005/10/11/479477.aspx"&gt;he hadn&amp;rsquo;t read Fowler&amp;rsquo;s description of PresentationModel&lt;/a&gt;.&amp;nbsp; It was a logical extension of the underlying platform.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Composition&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://martinfowler.com/eaaDev/PresentationModel.html"&gt;Fowler has this to say&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;In the case of composition a Presentation Model may contain one or many child Presentation Model instances&amp;hellip;&amp;rdquo;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;And &lt;a href="http://blogs.msdn.com/johngossman/archive/2005/10/09/478894.aspx"&gt;Gossman says&lt;/a&gt;*** that the MVVM pattern has a&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;hierarchical nature &amp;hellip; as we practice it&amp;rdquo;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;WPF is a composition-based framework at its core.&amp;nbsp; Consider the RichTextBox control.&amp;nbsp; It&amp;rsquo;s behavior is in the control class.&amp;nbsp; Now, look at its ControlTemplate.&amp;nbsp; It typically contains a ScrollViewer.&amp;nbsp; That&amp;rsquo;s a completely different control with its own behavior and view.&amp;nbsp; Here&amp;rsquo;s where it gets really interesting.&amp;nbsp; When you create a RichTextBox, at runtime, WPF is composing the behavior of multiple controls and in parallel composing the views of those controls (because the ScrollViewer is composed of ScrollBars&amp;hellip;which have their own behavior/view).&amp;nbsp; You can, of coarse, accomplish the same thing with DataTemplates and ViewModels.&amp;nbsp; In many ways, I think this is the &lt;a href="http://www.realultimatepower.net/"&gt;real ultimate power&lt;/a&gt; of WPF/SL.&amp;nbsp; I&amp;rsquo;ve found this to be an extremely important concept.&amp;nbsp; When tackling a complex screen, decompose it into a series of smaller models.&amp;nbsp; WPF&amp;rsquo;s compositional nature encourages this, as it can easily put the pieces together for you.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve listed a very small number of concepts that I believe are central to development with WPF/SL.&amp;nbsp; It is out of these same concepts that MVVM naturally emerges.&amp;nbsp; I&amp;rsquo;m sure many WPF devs started building things this way without reading either Gossman or Fowler.&amp;nbsp; It makes sense for the platform.&amp;nbsp; It exhibits &lt;em&gt;Conceptual Integrity&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;* I&amp;rsquo;m ignoring it because it has been answered very thoroughly many times before and I&amp;rsquo;m assuming you have already decided this is a good idea.&lt;/p&gt;
&lt;p&gt;** Note that Fowler hopes .NET will bring improved databinding to the scene.&lt;/p&gt;
&lt;p&gt;*** Actually, &lt;a href="http://blogs.msdn.com/johngossman/archive/2005/10/09/478894.aspx"&gt;Gossman&amp;rsquo;s second explanation of MVVM&lt;/a&gt; is the better of the two.&amp;nbsp; I&amp;rsquo;m afraid far less people have read this than &lt;a href="http://blogs.msdn.com/johngossman/archive/2005/10/08/478683.aspx"&gt;the original.&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=51102" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF/default.aspx">WPF</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Xaml/default.aspx">Xaml</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/databinding/default.aspx">databinding</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Control+Templates/default.aspx">Control Templates</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF_2F00_e/default.aspx">WPF/e</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/RIA/default.aspx">RIA</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/MVVM/default.aspx">MVVM</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/UI+Architecture/default.aspx">UI Architecture</category></item><item><title>Herding Code 57 – Presentation Pattern Goodness</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2009/08/19/herding-code-57-presentation-pattern-goodness.aspx</link><pubDate>Wed, 19 Aug 2009 23:26:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:50132</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>4</slash:comments><wfw:commentRss>http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=50132</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2009/08/19/herding-code-57-presentation-pattern-goodness.aspx#comments</comments><description>&lt;p&gt;If you are interested in presentation patterns, &lt;a href="http://codebetter.com/blogs/jeremy.miller/"&gt;Jeremy Miller&lt;/a&gt;, &lt;a href="http://neverindoubtnet.blogspot.com/"&gt;Ward Bell&lt;/a&gt;, &lt;a href="http://codebetter.com/blogs/glenn.block/default.aspx"&gt;Glenn Block&lt;/a&gt; and myself discuss the subject on &lt;a href="http://herdingcode.com/?p=208"&gt;the latest Herding Code (57).&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=50132" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF/default.aspx">WPF</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF_2F00_e/default.aspx">WPF/e</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Caliburn/default.aspx">Caliburn</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/MVVM/default.aspx">MVVM</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/UI+Architecture/default.aspx">UI Architecture</category></item><item><title>MVVM Study Part 2 – “View of the Model” or “Model of the View” ?</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2009/08/02/mvvm-study-part-2-view-of-the-model-or-model-of-the-view.aspx</link><pubDate>Sun, 02 Aug 2009 21:38:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:49798</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>12</slash:comments><wfw:commentRss>http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=49798</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2009/08/02/mvvm-study-part-2-view-of-the-model-or-model-of-the-view.aspx#comments</comments><description>&lt;p&gt;As a follow-up to &lt;a target="_blank" href="http://devlicio.us/blogs/rob_eisenberg/archive/2009/07/07/mvvm-philosophy-and-case-studies-introduction.aspx"&gt;my last post on MVVM&lt;/a&gt;, I want to further investigate the ViewModel as a concept.&amp;nbsp; In commenting on my blog, one reader describes a ViewModel as &amp;ldquo;a UI oriented abstraction of the model.&amp;rdquo;&amp;nbsp; In that sense, he is saying that a ViewModel (VM) is simply a contextual &amp;ldquo;View of the Model&amp;rdquo; and that it is confusing to think of it in any other way.&amp;nbsp; However, when we construct a VM, we do so with the explicit intent of creating a public surface area that is easily bindable and supportive of the UI itself.&amp;nbsp; Therefore, the public properties and methods/commands exposed by the VM tend to form a &amp;ldquo;Model of the View.&amp;rdquo;&amp;nbsp; How do we justify these two views?&amp;nbsp; Are they really at odds with one another or are they merely two sides of the same coin?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Confusing Abstractions&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;One reason VM is confusing stems from its frequent use as an &lt;a href="http://www.dofactory.com/Patterns/PatternAdapter.aspx"&gt;Adapter&lt;/a&gt;, where it enables the incompatible interfaces of the UI and domain model to talk to one another.&amp;nbsp; However, using a VM for this purpose is mixing concerns.&amp;nbsp; A better solution would be to have an explicit &lt;a href="http://www.dofactory.com/Patterns/PatternFacade.aspx"&gt;Facade&lt;/a&gt;/&lt;a href="http://www.dofactory.com/Patterns/PatternAdapter.aspx"&gt;Adapter&lt;/a&gt;/&lt;a href="http://www.dofactory.com/Patterns/PatternBridge.aspx"&gt;Bridge&lt;/a&gt; handle communication between layers, freeing the VM to vary independently from the domain model.&amp;nbsp; When I&amp;rsquo;ve failed to make this distinction in the past, I&amp;rsquo;ve been burned&amp;hellip;bad.&amp;nbsp; Nevertheless, even if your VMs do operate like an extremely intricate adapter, it&amp;rsquo;s often &lt;em&gt;quite&lt;/em&gt; &lt;em&gt;unhelpful&lt;/em&gt; to think of the problem in this way.&amp;nbsp; Doing so can lead you to miss the realization that a VM has its own set of concerns, which primarily center around supporting the UI, not abstracting the domain.&amp;nbsp; That is to say, we don&amp;rsquo;t build a VM for the purpose of abstracting the domain model, we build it to power the UI.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How I Think&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When I&amp;rsquo;m constructing a system, I prefer to think of the VM as a state machine with the View being a visualization of the current state.&amp;nbsp; The user interacts with the View, causing &amp;ldquo;messages&amp;rdquo; (actions/commands/bindings) to be sent to the VM.&amp;nbsp; The VM receives and delegates or interprets these messages, which may or may not result in state changes and may or may not result in domain model interaction.&amp;nbsp; (I&amp;rsquo;ll discuss what these state machines look like more in future posts.)&amp;nbsp; The important thing to remember is that the VM is in control; the view makes &amp;ldquo;suggestions,&amp;rdquo; but the VM decides what happens when.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Flip Side&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;So, for me, the most helpful way of thinking of a VM is as a &amp;ldquo;Model of the View.&amp;rdquo;&amp;nbsp; But, is there value to the notion of &amp;ldquo;View of a Model?&amp;rdquo;&amp;nbsp; I had to go back and look at concrete code samples from past projects, consider what we did, why and what did or did not work before I could settle on an answer I feel confident about.&amp;nbsp; I saw code that I wrote two years ago in which I mixed adapter qualities with the view model rather than carefully thinking about modeling the view&amp;rsquo;s behavior.&amp;nbsp; It was hideous.&amp;nbsp; I&amp;rsquo;m not sure what I was thinking, but I wasn&amp;rsquo;t creating a &amp;ldquo;Model of the View.&amp;rdquo;&amp;nbsp; Then I looked at &lt;a href="http://www.nhprof.com/"&gt;NHProf&amp;rsquo;s&lt;/a&gt; code which has an explicit bridge (IBackendBridge) and a structural VM, whose implementation was easy to adapt and extend over the coarse of &lt;a href="http://ayende.com/Blog/archive/2009/02/13/tracking-nh-prof-performance-problem-on-aggressively-active-application.aspx"&gt;major architectural change&lt;/a&gt;.&amp;nbsp; It&amp;rsquo;s code has remained relatively simple and concise while delivering a rich feature set.&amp;nbsp; Here&amp;rsquo;s what I have determined.&amp;nbsp; If your view model happens to look like an abstraction of the domain or &amp;ldquo;View of the Model,&amp;rdquo; that shouldn&amp;rsquo;t surprise you.&amp;nbsp; It is a natural consequence of that fact that the entire presentation layer of your application is at a higher level of abstraction than the domain model.&amp;nbsp; From time to time you should think of your VM in this light.&amp;nbsp; It&amp;rsquo;s likely that doing so will reveal some implicit concepts in your domain which need to be made explicit.&amp;nbsp; This happens because the VM closely models exactly what the users are doing.&amp;nbsp; So, there is value in thinking in this way, but this value is completely different than what is gained from trying to model a view.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When building your VM, try to think of it as a &amp;ldquo;Model of the View,&amp;rdquo; but when building your &lt;em&gt;domain model&lt;/em&gt; revisit your VM, trying to see it as a &amp;ldquo;View of the Model&amp;rdquo; and ask yourself if the VMs implementation has any implications for your domain.&amp;nbsp; Naturally, this really only works when utilizing an iterative design methodology&amp;hellip;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=49798" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF/default.aspx">WPF</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF_2F00_e/default.aspx">WPF/e</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Caliburn/default.aspx">Caliburn</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/RIA/default.aspx">RIA</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/MVVM/default.aspx">MVVM</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/UI+Architecture/default.aspx">UI Architecture</category></item><item><title>Caliburn v1 Release Candidate 2 is Available!</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2009/07/25/caliburn-v1-release-candidate-2-is-available.aspx</link><pubDate>Sat, 25 Jul 2009 20:27:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:49555</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>6</slash:comments><wfw:commentRss>http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=49555</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2009/07/25/caliburn-v1-release-candidate-2-is-available.aspx#comments</comments><description>&lt;p&gt;I&amp;rsquo;ve put a ton of work into this release and I think we are finally almost ready for RTW!&amp;nbsp; You can &lt;a target="_blank" href="http://caliburn.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=30658"&gt;get the new RC2 bits here&lt;/a&gt;.&amp;nbsp; Please download them, try them and help me squash any final bugs that may remain.&amp;nbsp; Below is a list of things that have changed since RC1, its quite significant:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Added the official xmlns for caliburn: &lt;a href="http://www.caliburnproject.org"&gt;http://www.caliburnproject.org&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Added a Completed event to IResult (renamed from IExecutableResult)&lt;/li&gt;
&lt;li&gt;Renamed CompositeResult to SequentialResult&lt;/li&gt;
&lt;li&gt;Added a Starting event to IBackgroundTask.&lt;/li&gt;
&lt;li&gt;The filter interfaces have been renamed IPreExecuteFilter -&amp;gt; IPreProcessor, IPostExecuteFilter -&amp;gt; IPostProcessor, IRescueFilter -&amp;gt; IRescue, IInstanceAwareFilter -&amp;gt; IHandlerAware. Also, IMethodBinder was renamed to IMessageBinder and IMessageSupportingMethodBinding was renamed to IRoutedMessageWithOutcome (which caused a change in the IResult interface). The property ReturnPath on ActionMessage was renamed to OutcomePath.&lt;/li&gt;
&lt;li&gt;Enabled Unity, Castle, Ninject and MEF Adapters for Silverlight.&lt;/li&gt;
&lt;li&gt;Improvements to DefaultViewStrategy&lt;/li&gt;
&lt;li&gt;Added parameter and results of message to be bound to Resources.&lt;/li&gt;
&lt;li&gt;Enabled parameter special files to be &amp;quot;dotted&amp;quot; on. ie: $eventArgs.My.Property&lt;/li&gt;
&lt;li&gt;Additional attached properties are necessary: Attach, Attach2nd, Attach3rd and Attach4th&lt;/li&gt;
&lt;li&gt;IPresenterHost&amp;#39;s Presenters is now an instance of IObservableCollection&amp;lt;IPresenter&amp;gt;&lt;/li&gt;
&lt;li&gt;Introduced IAssemblySource as a way for any component to be made aware of inspectable assemblies.&lt;/li&gt;
&lt;li&gt;Reworked ComponentInfo&lt;/li&gt;
&lt;li&gt;Added the IWindowManager service for WPF. This enables a model-centric mechanism for showing dialogs and non-modal windows.&lt;/li&gt;
&lt;li&gt;Added the IViewAware interface which can be implemented by a model/presenter if it wishes to be aware of its view. &lt;/li&gt;
&lt;li&gt;Updated the build to compile for .NET 3.5, Silverlight 2.0 and Silverlight 3.0&lt;/li&gt;
&lt;li&gt;Updated all samples so that they has both SL2 and SL3 projects.&lt;/li&gt;
&lt;li&gt;Many more small features and API improvements...&lt;/li&gt;
&lt;li&gt;Fixed tons of bugs...&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=49555" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF/default.aspx">WPF</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Xaml/default.aspx">Xaml</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF_2F00_e/default.aspx">WPF/e</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/.NET+3.5/default.aspx">.NET 3.5</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Caliburn/default.aspx">Caliburn</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Featured/default.aspx">Featured</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/RIA/default.aspx">RIA</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/MVVM/default.aspx">MVVM</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/UI+Architecture/default.aspx">UI Architecture</category></item><item><title>Asynchronous Execution, Animation and more in MVVM with Caliburn</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2009/07/10/asynchronous-execution-animation-and-more-in-mvvm-with-caliburn.aspx</link><pubDate>Fri, 10 Jul 2009 04:21:24 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:49321</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>3</slash:comments><wfw:commentRss>http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=49321</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2009/07/10/asynchronous-execution-animation-and-more-in-mvvm-with-caliburn.aspx#comments</comments><description>&lt;p&gt;On the Silverlight Insiders mailing list there’s been a discussion about the difficulties of handling animations when trying to use an MVVM architecture.&amp;nbsp; I’m not going to go into the details here, as I am going to cover this more fully in a future blog post, but still, I could not resist showing off the elegant way that Caliburn solves this problem.&amp;nbsp; Here is some XAML:&lt;/p&gt;&lt;pre class="brush: xml;"&gt;&amp;lt;TextBox x:Name=&amp;quot;username&amp;quot; /&amp;gt;
&amp;lt;PasswordBox x:Name=&amp;quot;password&amp;quot; /&amp;gt;

&amp;lt;Button Content=&amp;quot;Login&amp;quot;
        pf:Message.Attach=&amp;quot;Login(username.Text, password)&amp;quot; /&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;And here is the code from the ViewModel that Caliburn execute when the user clicks the button: &lt;pre&gt;&lt;/pre&gt;&lt;pre class="brush: xml;"&gt;public IEnumerable&amp;lt;IResult&amp;gt; Login(string username, string password)
{
    _credential.Username = username;
    _credential.Password = password;

    var result = new Result();
    var request = new GetUserSettings(username);

    yield return new ProcessQuery(request, result, &amp;quot;Logging In...&amp;quot;);

    if (result.HasErrors)
    {
        yield return new ShowMessageBox(&amp;quot;The username or password provided is incorrect.&amp;quot;, &amp;quot;Access Denied&amp;quot;);
        yield break;
    }

    var response = result.GetResponse(request);

    if(response.Permissions == null || response.Permissions.Count &amp;lt; 1)
    {
        yield return new ShowMessageBox(&amp;quot;You do not have permission to access the dashboard.&amp;quot;, &amp;quot;Access Denied&amp;quot;);
        yield break;
    }

    _context.Permissions = response.Permissions;

    yield return new OpenWith&amp;lt;IShell, IDashboard&amp;gt;();
}
&lt;/pre&gt;
&lt;p&gt;Please note that the 1st, 2nd and 3rd yield statements above are all *asynchronous*, but the code within this action is executed in sequential order.&amp;nbsp; The 1st yield also triggers an animation...I can also do things like this:&lt;/p&gt;&lt;pre class="brush: xml;"&gt;yield return new BeginAnimation(&amp;quot;MyCoolAnimation&amp;quot;);
yield return new BeginAnimation(&amp;quot;This animation is next&amp;quot;);
yield return new BeginAnimation(&amp;quot;This animation plays last&amp;quot;);
&lt;/pre&gt;
&lt;p&gt;This gives the View Model a declarative way to handle animations without a need to reference the view.&amp;nbsp; Also, it should be noted that the above action relies on several UI services, but I can unit test this action without needing to mock anything.&amp;nbsp; The declarative nature of the action allows me to iterate over the results and simply use normal Asserts on the values.&amp;nbsp; Async programming becomes synchronous and playing Animations is peachy ;)&lt;/p&gt;
&lt;p&gt;More on this later, but I just had to show some code because I’m not sure many people know you can do this with Caliburn.&amp;nbsp; On my current Silverlight project, we are making extensive use of this.&amp;nbsp; It makes calling web services a breeze.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;ul&gt;&lt;/ul&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;&lt;pre&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=49321" width="1" height="1"&gt;</description></item><item><title>MVVM – Philosophy and Case Studies - Introduction</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2009/07/07/mvvm-philosophy-and-case-studies-introduction.aspx</link><pubDate>Wed, 08 Jul 2009 02:49:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:49128</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>18</slash:comments><wfw:commentRss>http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=49128</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2009/07/07/mvvm-philosophy-and-case-studies-introduction.aspx#comments</comments><description>&lt;p&gt;There&amp;rsquo;s been a lot of talk lately about MVVM (Model-View-ViewModel) in the WPF and Silverlight space.&amp;nbsp; Recently, &lt;a href="http://neverindoubtnet.blogspot.com/2009/05/birth-and-death-of-m-v-vm-triads.html"&gt;Ward Bell had an interesting post on the subject&lt;/a&gt; where he digs into some of the patterns he is using to support his MVVM triads.&amp;nbsp; The WPF/Silverlight community is constantly droning MVVM, but almost no one goes beyond stating their use of the pattern or giving an overly general description of it. That&amp;rsquo;s why I enjoyed &lt;a href="http://neverindoubtnet.blogspot.com/2009/05/birth-and-death-of-m-v-vm-triads.html"&gt;Ward&amp;rsquo;s post&lt;/a&gt;.&amp;nbsp; He&amp;rsquo;s trying to get into the nitty-gritty of his UI architecture rather than just chanting &amp;ldquo;I&amp;#39;m using MVVM&amp;quot; and leaving it at that.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m pleased that the WPF/SL community is taking UI architecture seriously, but I think we have a long way to go.&amp;nbsp; We need to dig deeper into the &amp;ldquo;how&amp;rdquo; of the MVVM and realize that a solid implementation is more that just creating a model and binding it to a view, with a dash of the &lt;a href="http://www.dofactory.com/Patterns/PatternCommand.aspx"&gt;Command&lt;/a&gt; pattern thrown in for good measure.&amp;nbsp; In fact, saying you are using MVVM for WPF/Silverlight is sort of like saying you are using MVC for web development.&amp;nbsp; It more or less states the general design approach you are taking to the UI architecture, but doesn&amp;rsquo;t say much about how the pattern is implemented or how individual features are represented within the &lt;em&gt;context&lt;/em&gt; of that design.&amp;nbsp; If you&amp;rsquo;ve been following the blogs on ASP.NET MVC, you&amp;rsquo;ve probably discovered that there is a lot more to it than just having Models, Views and Controllers.&amp;nbsp; It is easy to use the MVC pattern very poorly and the same goes for MVVM.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Speaking of context&amp;hellip;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When I first read the GoF book, I was baffled by its insistence that patterns were not tied to implementation.&amp;nbsp;&amp;nbsp; Sure, I understood that the &lt;a href="http://www.dofactory.com/Patterns/PatternIterator.aspx"&gt;Iterator&lt;/a&gt; pattern would be implemented differently in C++ than in C#, but I didn&amp;rsquo;t understand that other context-specific factors had a massive affect on the details of its implementation.&amp;nbsp; This &amp;ldquo;phenomena&amp;rdquo; manifests itself in greater degrees with respect to how high-level the pattern is.&amp;nbsp; A high-level pattern like MVC is a fine example of this.&amp;nbsp; Consider how the implementations would differ between a WinForms and an ASP.NET implementation of this pattern.&amp;nbsp; They would not resemble each other much at all.&amp;nbsp; The WinForms version would likely look a lot like an &lt;a href="http://www.dofactory.com/Patterns/PatternObserver.aspx"&gt;Observer&lt;/a&gt; or &lt;a href="http://www.dofactory.com/Patterns/PatternMediator.aspx"&gt;Mediator&lt;/a&gt; while the ASP.NET version would be very similar to a &lt;a href="http://www.dofactory.com/Patterns/PatternStrategy.aspx"&gt;Strategy&lt;/a&gt;.&amp;nbsp; In fact the WinForms version would look so different, you might not even call it MVC anymore, though you started out with an MVC mindset.&amp;nbsp; You could force the WinForms and ASP.NET implementations to look alike, but you would be creating a leaky abstraction by forcing an &lt;em&gt;artificial context&lt;/em&gt; for your design to live in.&lt;/p&gt;
&lt;p&gt;In the next couple of posts I am hoping to examine MVVM within the context of WPF/SL.&amp;nbsp; What does the base form of it look like?&amp;nbsp; What do more complex forms look like?&amp;nbsp; Why is this pattern a good fit for WPF/SL?&amp;nbsp; How does this pattern relate to MVP and MVC?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MVVM &amp;ndash; A Simplistic View&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If we take MVVM as a high level pattern, like MVC, then it becomes our general approach to architecting user interfaces.&amp;nbsp; It means that we will have components in three of the following &lt;em&gt;broad&lt;/em&gt; roles:&lt;/p&gt;
&lt;p&gt;Models &amp;ndash; These are the business-oriented components that are intended to be displayed or manipulated by the application.&amp;nbsp; They might be traditional business objects rehydrated from the DB, messages from a web service or anything else that has business meaning independent of presentation.&lt;/p&gt;
&lt;p&gt;Views &amp;ndash; WPF/Silverlight is a view framework and is thus intended to provided these components.&amp;nbsp; Their role is to display something on the screen.&amp;nbsp; Nothing more, nothing less.&lt;/p&gt;
&lt;p&gt;View Models &amp;ndash; This is a special type of model, intended to be an abstraction of the UI.&amp;nbsp; You can think of it as a &lt;em&gt;logical representation&lt;/em&gt; of the UI.&amp;nbsp; It is &amp;ldquo;connected&amp;rdquo; to the view at runtime through databinding.&lt;/p&gt;
&lt;p&gt;My guess is that you probably feel pretty comfortable with the idea of a Model or a View.&amp;nbsp; You can picture them in your mind.&amp;nbsp; But when it comes to View Models, things get foggy.&amp;nbsp; It means that we need to have a lot more discussion around what our View Models look like.&amp;nbsp; But, we cannot just discuss them abstractly.&amp;nbsp; We must look at specific scenarios and see how ordinary design patterns interplay to create a meaningful model of the UI.&amp;nbsp; In a few words, here&amp;rsquo;s my general philosophy and what I hope will become clear as we proceed:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The same OOD techniques you use to build your backend systems are used to construct your View Models.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To that end, I am hoping to put together several posts on the subject.&amp;nbsp; I am planning to contact several of my previous clients with the intention of gaining permission to discuss small portions of their applications; or to discuss them at a very high level.&amp;nbsp; I want to show specific problems and demonstrate how we used common design patterns to build a rich View Model.&amp;nbsp; It is my hope that this will begin a richer discussion on the topic within our community.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=49128" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF/default.aspx">WPF</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/.NET+3.0/default.aspx">.NET 3.0</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/databinding/default.aspx">databinding</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF_2F00_e/default.aspx">WPF/e</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/.NET+3.5/default.aspx">.NET 3.5</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/MVVM/default.aspx">MVVM</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/UI+Architecture/default.aspx">UI Architecture</category></item><item><title>Caliburn v1 Release Candidate</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2009/06/13/caliburn-v1-release-candidate.aspx</link><pubDate>Sat, 13 Jun 2009 04:19:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:47896</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>5</slash:comments><wfw:commentRss>http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=47896</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2009/06/13/caliburn-v1-release-candidate.aspx#comments</comments><description>&lt;p&gt;On Friday I published the Release Candidate for Caliburn.&amp;nbsp; You can get it &lt;a target="_blank" href="http://caliburn.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28706"&gt;here&lt;/a&gt;.&amp;nbsp; I&amp;rsquo;m hoping to only do bug fixes and a few minor changes between now and release.&amp;nbsp; There have been quite a few important changes since the Beta:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Refactored assemblies for greater ease of use. &lt;/li&gt;
&lt;li&gt;Implemented an Application base class that supports model-first development. &lt;/li&gt;
&lt;li&gt;Introduced IViewStrategy and the View.Model attached property. &lt;/li&gt;
&lt;li&gt;Added CommandSource triggers &lt;/li&gt;
&lt;li&gt;Tweaked the implementation of Actions/Commands so that it performs better and is more intelligent &lt;/li&gt;
&lt;li&gt;Updated dependencies on other OSS projects&lt;/li&gt;
&lt;li&gt;Added a WPF version of the LOB Sample &lt;/li&gt;
&lt;li&gt;Factored out mini-frameworks for the both the WPF and Silverlight LOB samples. &lt;/li&gt;
&lt;li&gt;Implemented binding validation of hierarchical path notation. &lt;/li&gt;
&lt;li&gt;Fixed many bugs throughout the framework.&lt;/li&gt;
&lt;li&gt;Lots of other random features and improvements&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I hope that if you are building WPF or Silverlight applications you will take some time to evaluate &lt;a target="_blank" href="http://caliburn.codeplex.com/"&gt;Caliburn&lt;/a&gt; and give me some feedback.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=47896" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF/default.aspx">WPF</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Xaml/default.aspx">Xaml</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/databinding/default.aspx">databinding</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF_2F00_e/default.aspx">WPF/e</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/.NET+3.5/default.aspx">.NET 3.5</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Caliburn/default.aspx">Caliburn</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Featured/default.aspx">Featured</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Silverlight/default.aspx">Silverlight</category></item></channel></rss>
