我想弄清楚为什么Caliburn.Micro没有绑定我的Screen DisplayName属性到窗口标题开箱。Caliburn Mico:屏幕的ActivateItem.DisplayName属性不会绑定到窗口标题自动
我看了这篇文章: https://stackoverflow.com/a/9072035/2111892 那么,不应该手动绑定它吗?
我的导体是这样的:
[Export(typeof (ShellViewModel))]
public class ShellViewModel : Conductor<Screen>, IHandle<IViewModelMessage>
{
[ImportMany(typeof (IViewModelMessageHandler))]
private IEnumerable<IViewModelMessageHandler> _messageHandlers;
[ImportingConstructor]
public ShellViewModel(IEventAggregator eventAggregator)
{
eventAggregator.Subscribe(this);
}
protected override void OnActivate()
{
var viewModel = IoC.Get<LoginViewModel>();
ActivateItem(viewModel);
}
}
...而我的屏幕正在寻找这样的:
[Export(typeof(LoginViewModel))]
public class LoginViewModel : Screen
{
[ImportingConstructor]
public LoginViewModel(IEventAggregator eventAggregator, IMessageService messageService, IClient client, IClientReceiver receiver, IClientTransceiver transceiver)
{
DisplayName = "Login";
}
}
难道我犯了一个错误还是我理解不正确的东西?
编辑:\
ShellView顺便说一句是这样的:
<UserControl x:Class="Test.Client.Gui.Views.ShellView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="900"
Width="1000">
<Grid VerticalAlignment="Center">
<ContentControl x:Name="ActiveItem" />
</Grid>
</UserControl>
喜欢将其绑定到ActiveItem.DisplayName属性:)好吧,这就是我想知道的,所以它不会自动为我做这件事。没关系,那没关系,我会手动绑定它:) – Jannik