Problem with binding Title of WPF window on property in shell view model class

Jan 6, 2011 at 1:31 PM

Hi, I have simple problem with binding property in shell view model class on Title property of WPF Window- it’s shell.

My shell view look like this:

<Window x:Class="Spirit.Views.ShellView"
        Title="{Binding Path=Title}" >
        <ContentControl x:Name="ActiveItem" />

shell view model class:

public class ShellViewModel : Conductor<IScreen>.Collection.OneActive, IShellViewModel
    public string Title { get; set; }

    public ShellViewModel()
        Title = "Spirit";

If I run app Title of shell view (WPF window) is Namespace.ShellViewModelClass, no value of property Title in shell view model class.

If I active some screen in shell view, Title property of window is Namespace.ViewModelClass.

How can I remove this behavior? Thank for advice.

Jan 6, 2011 at 2:05 PM

The default behaviour will bind the Window.Title to the view-model DisplayName. Unless the DisplayName is already used, you can avoid to define a Title property.

Jan 6, 2011 at 2:19 PM

Thank, I don’t know about DispalyName property.