无法使用Caliburn显示对话框

时间:2014-11-10 11:36:20

标签: c# .net wpf mvvm caliburn.micro

public class ShellViewModel : Conductor...

    private readonly IWindowManager _windowManager;
    private readonly Lazy<StartupDialogViewModel> _startupDialog;

    public ShellViewModel(IWindowManager windowManager, 
        Lazy<StartupDialogViewModel> startupDialog)
    {
        _windowManager = windowManager;
        _startupDialog = startupDialog;
    }

    protected override void OnViewLoaded(object view) {

        base.OnViewLoaded(view);

        if(_windowManager.ShowDialog(_startupDialog.Value) == true; // ex

    }

例外详细信息

  

无法将所有者属性设置为之前未显示的窗口。

微量

  System.Windows.Window.set_Owner上的

(窗口值)      at Caliburn.Micro.WindowManager.EnsureWindow(Object model,Object view,Boolean isDialog)      在Caliburn.Micro.WindowManager.CreateWindow(对象rootModel,Boolean isDialog,对象上下文,IDictionary 2 settings) at Caliburn.Micro.WindowManager.ShowDialog(Object rootModel, Object context, IDictionary 2设置)      在XXXXX.ShellViewModel.OnViewLoaded(对象视图)

这可能是什么原因?我还尝试在ShowDialog内调用窗口管理器OnViewReady,但没有运气。

0 个答案:

没有答案