我在 WPF Window 的 Title 属性上的 shell 视图模型类中的绑定属性有一个简单的问题 - 它是 shell。
我的外壳视图如下所示:
<Window x:Class="Spirit.Views.ShellView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="{Binding Path=Title}" >
<Grid>
<ContentControl x:Name="ActiveItem" />
</Grid>
</Window>
外壳视图模型类:
[Export(typeof(IShellViewModel))]
public class ShellViewModel : Conductor<IScreen>.Collection.OneActive, IShellViewModel
{
private string _title;
public string Title
{
get { return _title; }
set
{
_title = value;
NotifyOfPropertyChange(()=>Title);
}
}
public ShellViewModel()
{
Title = "Spirit";
}
}
如果我运行外壳视图(WPF 窗口)的应用程序标题为 Namespace.ShellViewModelClass,则外壳视图模型类中没有属性标题的值。
如果我在 shell 视图中激活某个屏幕,则窗口的 Title 属性是 Namespace.ViewModelClass。
我怎样才能消除这种行为?感谢您的建议。