IWindowManager showing a dialog with resize/minimize

Topics: UI Architecture
Sep 27, 2012 at 6:10 AM


I was wondering if it's possible to have a dialog with resize feature and if how... it's also possible to substituite the ChildWindow that's opened with the ShowDialog with the thirds party Telerik RadWindow (that has the resize mode)



Sep 27, 2012 at 6:55 AM


of course you can substitute the ChildWindow with the RadWindow - you just have to write your own CustomWindowManager that derives from WindowManager and override the methods ShowDialog and EnsureWindow to utilize RadWindow, then create your own WindowConductor class (like the WindowConductor class in WindowManager.cs in CM source) and exchange every ChildWindow with RadWindow. Then exchange the initialization of a CM WindowConductor with your CustomWindowConductor in the method ShowDialog.

That should do the trick.

Do not forget to swap your CustomWindowManager with the CM WindowConductor in the Bootstrapper!



Sep 27, 2012 at 7:55 AM

Hello Roland,

thanks for your answer... just a question.......I've implemented the WindowManagerClass as


    public override void ShowDialog(object rootModel, object context = null, System.Collections.Generic.IDictionary<string, object> settings = null)
            var view = EnsureWindowTelerik(rootModel, ViewLocator.LocateForModel(rootModel, null, context));
            ViewModelBinder.Bind(rootModel, view, context);

            var haveDisplayName = rootModel as IHaveDisplayName;
            if (haveDisplayName != null && !ConventionManager.HasBinding(view, ChildWindow.TitleProperty))
                var binding = new Binding("DisplayName") { Mode = BindingMode.TwoWay };
                view.SetBinding(ChildWindow.TitleProperty, binding);

            ApplySettings(view, settings);

            new IFWindowConductor(rootModel, view);


        protected RadWindow EnsureWindowTelerik(object model, object view)
            var window = view as RadWindow;

            if (window == null)
                window = new RadWindow { Content = view };
                window.SetValue(View.IsGeneratedProperty, true);

            return window;

        protected override ChildWindow EnsureWindow(object model, object view)
            return base.EnsureWindow(model, view);

        bool ApplySettings(object target, IEnumerable<KeyValuePair<string, object>> settings)
            if (settings != null)
                var type = target.GetType();

                foreach (var pair in settings)
                    var propertyInfo = type.GetProperty(pair.Key);

                    if (propertyInfo != null)
                        propertyInfo.SetValue(target, pair.Value, null);

                return true;

            return false;


The Problem I've got is that RadWindow inherits from WindowBase and not from ContentControl ... is my EnsureWindowTelerik good? for the Conductor I'm ok...



Another question... I'm also using Caliburn.Micro.Contrib but in italian for the Yes button I got "Foo", when showing a messagebox.. how can I redefine the value for "foo"?


Sep 27, 2012 at 8:10 AM

RadWindow does inherit from ContentControl - according to Telerik Docs:


In ShowDialog, you should change the TitleProperty binding to the RadWindow's TitleProperty.

By the way, maybe there is already a solution for your problems, take a look:


Sep 27, 2012 at 8:17 AM

Hello, I was just using the caraulean's assembly for the tabcontrol... but it doesn't use the RadWindow...  I was following this to configure the bootsrapper




but in SL application I don't have

var batch = new CompositionBatch();

        batch.AddExportedValue, what should I use?
Thanks and sorry for disturbing you...
Sep 27, 2012 at 8:57 AM

caraulean has implemented a substitute for the WindowManager:


I think this is useful for you!

I do not understand your last question. To get your CustomWindowManager working you change the following code:

    var batch = new CompositionBatch();

    //Change this line...
    batch.AddExportedValue<IWindowManager>(new WindowManager());

    //to this line:
    batch.AddExportedValue<IWindowManager>(new CustomWindowManager());

Oct 9, 2012 at 2:34 PM

Hello Roland...I've got a strange problem in my implemetnation of WindowManager and RadWindow.... I've the Buttons cutted of... how do I manage the button's size and appeal?

Oct 10, 2012 at 6:19 AM

Well, that's quite difficult to diagnose without knowing how the actual implementation looks like. It might be that the dialog buttons have a maximum width, thus the content is cut off.

I'm afraid I can't help you without further knowledge about the implementation.

Oct 10, 2012 at 6:23 AM

I think it's due to the dialoghostview of cocktail... is there a way I can override the default view?


The View is Cocktail.DialogHostView ... I've never understood how to override a view with CM!

Oct 10, 2012 at 6:56 AM

Ah, ok. You are using Cocktail. Indeed, the width of the button is set to a specific value in the DialogHostView:

<Button Width="75"
    Content="{Binding Content}"
    IsEnabled="{Binding Enabled}" />

But you can customize the DialogHost:


Oct 10, 2012 at 7:05 AM

Thanks... I've customized it but I think I'm still missing a thing... where do I tell to use my DialogHost and not the cocktail one? The drc wiki ends with the view and I'm ok...but later?

Oct 11, 2012 at 6:38 AM

I have to admit, you caught me on the wrong foot! I've posted a question in the Cocktail forum (http://www.ideablade.com/forum/forum_posts.asp?TID=3355&PID=14815#14815).

I'll come back to you as soon as it is answered!

Oct 11, 2012 at 3:59 PM

Marcel Good just answered the question:

"It will automatically discover it through MEF and use yours instead of the default."

Hope this helps!