Why doesn't the SL version of Cinch have a IUIVisualizerService

Mar 21, 2011 at 3:33 AM

Not having this in the SL version makes it harder to build ViewModels that work on SL and WPF. I'd be interested in understanding why this doesn't exist in SL.

Mar 21, 2011 at 8:30 AM
Edited Mar 21, 2011 at 8:36 AM


The reason for this is due to the fact that Silverlight ChildWindow.Show() is not blocking as far as code goes. For example if I run this SL4 code

        private void Button_Click(object sender, RoutedEventArgs e)
            SomeChildWindow x = new SomeChildWindow();
            String s = "the Cat";

I see the MessageBox "The Cat" first then the ChildWindow is shown. So Silverlights ChildWindow.Show is not truly blocking, even though when you show a ChildWindow from a users point of view it looks modal, so is more like what you get in WPF when you call Window.ShowDialog() which is blocking and Modal. Now in WPF you also have Window.Show() which is also not blocking just like Silverlight, but when you call that the Window really is not Modal but back to Silverlight calling ChildWindow.Show() is not only non blocking but also gives the appearance of being Modal. Come on Microsoft some API parity please.

In WPF land you also have ShowDialog() which is blocking and Modal. Both Window methods in WPF land return a bool dialogresult, which is something Silverlights ChildWindow.Show() just does not do.

The bottom line is the ChildWindow API is flying in the face of how things have worked since winforms v1.

As such in Silverlight you have to rely on callbacks to tell you about ChildWindow result, which you do not have to do in WPF as that comes out of the box. Very different scenarios actually.

So in WPF you have to use IUIVisualizerService, and in Siliverlight you have to use IChildWindowService.

Believe me I wish I did not have to do this, but until Microsoft make the ChildWindow API work the same as Window API, its what has to happens.

Mar 21, 2011 at 8:34 AM

Thanks for the info. So would callbacks for both be a 'lowest-common-denominator' approach that would work for showing modal dialogs for both?

Mar 21, 2011 at 12:43 PM

I would think so, but to do that YOU will have to write your own common WPF/SL service. It should not be so hard to do, and when you are done you can just Mef attribute it up as rest of Cinch does. Good luck

Mar 21, 2011 at 12:58 PM

Thanks. I understand it's 'get off the bus and walk' time re: writing my own. 

Mar 21, 2011 at 1:06 PM

Yeah its quite a hard call sometimes creating a framework, one tries to create best things for people to use as you can. Sometimes this turns out to not be what people want....Like now. Thing that is cool about CInchV2 and MeffedMVVM is if you don't like my services, just write your own, jobs a goodun as we say here.


Hope you find the rest of the framework suites your needs, overall I am very happy with how Cinch worked out.


Have fun now

Mar 21, 2011 at 1:10 PM

I didn't want that to come off sounding so negative - like all frameworks I understand that there are times where it won't meet my needs and Cinch has certainly been interesting to look at. Since it supported SL and WPF I assumed there was more of an effort at API compatibility between the two versions of Cinch. I can see now you haven't gone down this path (Microsoft didn't...so why should you :-) ). If I develop anything useful (and if the person I'm doing this for will let me) I'll be sure to contribute it back.

Mar 21, 2011 at 2:25 PM

Relax I did not think you were negative at all, I was just explaining where I was coming from. The reason I made choices I did is a) It started as WPF only so I chose to use all support for Window I could b) I rather use whats right for the job rather than creating really generic thing, that only gives you 60% of what you could do if you went non generic route.


That said it would be nice to see more API parity from Microsoft.


As far as Cinch goes this one you are talking about is the only special case I feel, there are things missing from SL that can be done in WPF, but that is more to do with SL sandboxing etc etc than anything else.


Have fun now