从 Caliburn Micro 的 WindowManager.cs 中删除您的 CreateWindow 并添加此代码。
protected virtual Window CreateWindow(object rootModel, bool isDialog, object context, IDictionary<string, object> settings) {
var view = EnsureWindow(rootModel, ViewLocator.LocateForModel(rootModel, null, context), isDialog);
ViewModelBinder.Bind(rootModel, view, context);
var haveDisplayName = rootModel as IHaveDisplayName;
if (haveDisplayName != null && !ConventionManager.HasBinding(view, Window.TitleProperty)) {
var binding = new Binding("DisplayName") { Mode = BindingMode.TwoWay };
view.SetBinding(Window.TitleProperty, binding);
}
view.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(Window_MouseDown);
ApplySettings(view, settings);
new WindowConductor(rootModel, view);
return view;
}
void Window_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
var view = sender as Window;
view.DragMove();
}