Cinch : Some code changes

I just got back of holiday (3 weeks away….nice), while I was away a number of issues have been reported about my Cinch MVVM framework and I am pleased to say I have fixed all these, and they are now available for download.


I have addressed the following changes:

1. Syntax text highlighting in code generator to use Daniel Grunwalds Avalon Edit, which is free so everyone now gets super neato text highlighting

2. Fixed problem with TabControlEx not selecting 1st item when used in UserControl as
   described by the following forum entry :

3. Fixed small typo error in SimpleRule.cs comments

4. Modified EditableValidatingObject and EditableValidatingViewModelBase to make sure that
   CancelEdit() method sets internal stored data to null

5. Fixed CloseActivePopupCommand always returning true, as described in this forum comment :


So if you use my Cinch MVVM framework it may well be worth your while downloading the latest Source code change set





  1. Hi Sacha,
    I would be very interested in taking a one(two) day full immersion course in learning MVVM the Cinch-way.
    In case you receive similar requests and organize such a course… let me know.
    Alternatively have you consider recording a series of tutorials about it? I’d be you customer.
    Yes, I know you wrote some articles (I read them) but MVVM is quite new, Cinche is even newer and sometimes you need a little help to get started in a real app.
    Best regards
    Roberto Dalmonte


  2. I’ve been using your framework for the last month or so for a side project I’m working on. I think you did a great job on it.

    I’ve uploaded a couple patches to the codeplex site and I was wondering if you were planning on doing any more work on the framework. I’ve made a couple changes that have made the framework a little better for me to work with, and I think others may find them helpful as well.


  3. Jacob

    from your patch comments it looks like you wanted to add Lamda registration to Mediator.

    It ALWAYS did that, using the

    public void Register(string message, Delegate callback)


    As far as more work for the framework, its mainly done, I have 2 more changes, but after that I think I am done with it for now.

    These changes will come soon, after I install Win7


  4. Hello Sacha,

    Thank you for this framework, it made me better understand mvvm.

    I am trying to make a sort of plugin/addin architecture to make a flexible app, adding a view + viewmodel from a different assembly. The loading of the view and viewmodel work, the problem is the datatemplate for connecting the view tot the viewmodel. I can’t properly load it. I did some testing with loading xaml with xamlreader and making the datatemplate from code to load into the main view window but the application breaks on loading. Would you know a way of doing this, a guideline?

    I noticed that mediator messages created keep the element alive. I made a treeview that loaded data, every item as a viewmodelbase item. Every item had a mediator message. After a while loading different data in the treeview the message count was rising to a couple of thousand messages. Now I use a timer cleaning up when idle.

    I made a debugger viewmodel that counts the viewmodels alive, the messages and you can select the count for a specific message.

    When a message isn’t called, references aren’t cleaned up properly by the ‘GetActions’ method in the ‘MessageToActionsMap’ so removed viewmodels stay alive. I don’t know if I describe it properly, but I think that’s what happens.

    Best Regards

    Brecht Verhaeghe


  5. I’m not sure I follow you on the Register method taking a Lambda. Can you give me an example of how you would pass a Lambda to your Register Method?

    This is what I mean by taking a Lambda:
    myMediator.Register(“blah”, (string x) => DoSomething(x));
    Which is no different than:
    myMediator.Register(“blah”, x => DoSomething(x));

    I guess you could pass this:
    myMediator.Register(“blah”, new Action(x => DoSomething(x)));

    Anyway, I found it useful, because I’m lazy, so I added it for my project. If anyone else does, it’s there to add.

    The other thing I added, about passing the EventArgs with SingleEventCommand, I found useful also.



  6. err… Squashed out my <string> after .Register in the second example above.

    myMediator.Register<string>(“blah”, x => DoSomething(x));



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s