如何在文档组(DevExpress WPF mvvm)中获取活动的选项卡式或浮动文档?
How to get active tabbed or floating document in document group (DevExpress WPF mvvm)?
又是我:)
我为应用程序制作了全局 Escape
快捷方式。它从全局挂钩实现,并在 DomainModelContext
中发送关闭消息(主要 UserControl
来自脚手架向导)。我尝试了不好的方法 - 使用代码隐藏。
我用 DockLayoutManager.DockController.Close(DockLayoutManager.ActiveDockItem)
对于关闭选项卡,但它的方法关闭所有内容,包括 LayoutPanel :(
我如何使用选项卡式和浮动文档实现关闭活动文档。
在文档下,我指的是View继承自SingleObjectViewModel或者手动取消停靠的View
完成任务的正确方法是在视图模型级别处理 CloseMessage(我相信是 DomainModelContextViewModel)。
在这个级别你可以使用IDocumentManagerService:
的API
void OnCloseMessage() {
var activeDocument = DocumentManagerService.ActiveDocument;
if(activeDocument != null)
activeDocument.Close();
}
注意:IDocumentManagerService
(TabbedDocumentUIService)的具体实现应该在DomainModelContextView
.
内注册
又是我:)
我为应用程序制作了全局 Escape
快捷方式。它从全局挂钩实现,并在 DomainModelContext
中发送关闭消息(主要 UserControl
来自脚手架向导)。我尝试了不好的方法 - 使用代码隐藏。
我用 DockLayoutManager.DockController.Close(DockLayoutManager.ActiveDockItem)
对于关闭选项卡,但它的方法关闭所有内容,包括 LayoutPanel :(
我如何使用选项卡式和浮动文档实现关闭活动文档。
在文档下,我指的是View继承自SingleObjectViewModel或者手动取消停靠的View
完成任务的正确方法是在视图模型级别处理 CloseMessage(我相信是 DomainModelContextViewModel)。
在这个级别你可以使用IDocumentManagerService:
void OnCloseMessage() {
var activeDocument = DocumentManagerService.ActiveDocument;
if(activeDocument != null)
activeDocument.Close();
}
注意:IDocumentManagerService
(TabbedDocumentUIService)的具体实现应该在DomainModelContextView
.