Avalon Dock 和单独窗口中的用户控制 [英] User control in avalon dock and separate window

查看:29
本文介绍了Avalon Dock 和单独窗口中的用户控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一堆用户控件,它们可以做不同的事情——比如维护屏幕、查询屏幕、报告屏幕之类的.每个屏幕都有一个专用的用途,单个用户控件包含一个屏幕的所有功能.

I'm developing a bunch of user controls which do different things - like a maintenance screen, enquiry screen, report screen that sort of thing. Each screen has a dedicated purpose and a single user control holds all the functionality for the one screen.

我正在使用 avalondock 并且可以将这些用户控件放入 LayoutDocuments.这会为每个屏幕/用户控件创建一个单独的选项卡.我有一个菜单系统设置,因此用户可以选择他们需要访问的屏幕.对于每个新屏幕,我创建一个新的 LayoutDocument,向其添加适当的控件,然后将 LayoutDocument 添加到停靠面板的子项.

I'm using avalondock and can place these user controls into LayoutDocuments. This creates a separate tab for each screen/user control. I've got a menu system setup so users can choose which screens they need access to. For each new screen I create a new LayoutDocument, add the appropriate control to it, then add the LayoutDocument to the Docking panel's children.

一切正常.

Avalon Dock 还具有能够拖出布局文档并使其浮动的功能 - 如果您愿意,您也可以将其停靠在应用程序的其他位置.

Avalon dock also has the feature of being able to drag out the layout document and make it float - you can also dock it somewhere else in the app if you wish.

我想将这个概念更进一步:能够说右键单击布局文档并选择制作外部窗口"(我稍后会弄清楚确切的措辞).此操作的效果是在任务栏中创建一个带有自己图标的新应用程序;能够在它和其他应用程序之间使用 alt-tab;

I'd like to take this concept one step further: Being able to say right click on a layout document and choose "Make external window" (i'll work out the exact wording later). The effect of this action would be to create a new application with it's own icon in the task bar; being able to alt-tab between it and other apps;

有点像当您在 Excel 中编辑文档然后打开 Excel 的第二个实例时.在 Windows 7 中,您会在任务栏中看到两个 excel 图标(一个在另一个后面),您可以在它们之间使用 alt-tab.

Kind of like when you're in say Excel editing a document and you then open up a second instance of excel. In Windows 7 you get two excel icons in the task bar (one behind the other), and you can alt-tab between them.

这几乎就是我所追求的行为.然而,第二个应用程序并不是第一个应用程序的完整副本;它只有一个用户选择的用户控件.

This is nearly the behaviour that i'm after. However the second app isn't a full blown copy of the first; it has only the one user control that the user selected.

这是我卡住的地方,需要一些指导.

This is where i'm stuck and would like a bit of guidance.

我想我可能需要某种外壳应用程序,我可以在其中传递我想要的用户控件.shell 将充当带有标题、X、最小化等的窗口;用户控件将成为该外壳的唯一内容.使用 process.start 创建新进程并启动 ?

I'm thinking that i'll probably need some kind of shell app where I can pass in the user control that I want. The shell would act as a window with title, X, minimising etc; the user control would then be the sole content of that shell. Use process.start to create new process and launch ?

理想情况下,我能够以与用户当前正在查看的相同状态传递相同的控件 - 因此,例如,如果他们在维护屏幕中编辑某些客户记录的一部分,则选择外部窗口" 选项,相同的客户记录将出现在新窗口中.

Ideally i'd be able to pass in the same control in the same state as the user is currently viewing - so if for example they are part way through editing some customer record in a maintenance screen, then choose the "external window" option, that same customer record would appear in the new window.

如果我在正确的轨道上,有没有人做过类似的事情或提供建议?

Has anyone done something similar or offer advice if i'm on the right track ?

我想我知道如何创建一个 shell 应用程序,但不确定如何将用户控件动态传递给它.我想避免为每个用户控件创建不同的 shell 应用程序.

I think I know how to create a shell app but not sure on passing a user control to it dynamically. I'd like to avoid creating different shell apps for each user control.

推荐答案

无需为该方案启动新流程.

No need to start a new process for that scenario.

只需创建一个新的 Window 在运行时添加您的 UserControl 并从 DockingManager 中删除 UserControl.如果您希望它显示在那里,请确保 Window 设置了 ShowInTaskbar.

Just create a new Window add your UserControl at runtime and remove the UserControl from the DockingManager. Make sure the Window has ShowInTaskbar set if you want it to show up there.

要获取将 UserControl 作为单独的 Window 取消停靠的命令,您只需重新设置 ContextMenu 的样式以合并您的命令(以查看 VS2010 主题以及 ContextMenu 在那里的样式 VS2010 主题.xaml).

To get the command to undock the UserControl as a seperate Window you just have to restyle the ContextMenu to incorporate your command (take a look at the VS2010 theme and how the ContextMenu is styled there VS2010 theme.xaml).

这篇关于Avalon Dock 和单独窗口中的用户控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆