Search code examples
c#wpfmvvmviewmodelcaliburn

Window title is overwritten when using Caliburn's conductor<object> in view model


New to Caliburn and WPF MVVM, so I may be overlooking something pretty simple and I couldn't find anything searching the web.

Set up a simple wpf project with Caliburn.Micro. Set window title in ShellView.xaml. Works fine. Main MetroWindow displays the title as expcted.

Works fine:

[Export(typeof (IShell))]
public class ShellViewModel : PropertyChangedBased, IShell
{}

But change to:

[Export(typeof (IShell))]
public class ShellViewModel : Conductor<object>
{}

and Window title is the fully qualified name of this ViewModel. ANy help would be appreciated. Thanks.


Solution

  • You can use it like this:

    [Export(typeof (IShell))]
    public class ShellViewModel : Conductor<IScreen>
    {
        public ShellViewModel()
        {
            DisplayName = "Your window title";
        }
    }
    

    In my repository you can find some applications in WPF using Caliburn.Micro, for example: