Window Service
允许您将视图显示为独立的窗口(窗体),并从 ViewModel 层管理这些窗口。
接口
IWindowService
托管控件
- XtraForm
- RibbonForm
- FlyoutPanel
全局注册
C#
MVVMContext.RegisterXtraFormService();MVVMContext.RegisterFlyoutWindowService();MVVMContext.RegisterRibbonWindowService();
VB.NET
MVVMContext.RegisterXtraFormService()MVVMContext.RegisterFlyoutWindowService()MVVMContext.RegisterRibbonWindowService()
本地注册
C#
mvvmContext1.RegisterService(WindowService.Create(this, DefaultWindowServiceType.RibbonForm, "Window Title"));mvvmContext1.RegisterService(WindowService.CreateXtraFormService(this, "Window Title"));mvvmContext1.RegisterService(WindowService.CreateRibbonWindowService(this, "Window Title"));mvvmContext1.RegisterService(WindowService.CreateFlyoutWindowService(this, "Window Title"));
VB.NET
mvvmContext1.RegisterService(WindowService.Create(Me, DefaultWindowServiceType.RibbonForm, "Window Title"))mvvmContext1.RegisterService(WindowService.CreateXtraFormService(Me, "Window Title"))mvvmContext1.RegisterService(WindowService.CreateRibbonWindowService(Me, "Window Title"))mvvmContext1.RegisterService(WindowService.CreateFlyoutWindowService(Me, "Window Title"))
Create() 方法
- CreateXtraFormService(IWin32Window owner, string title = null) – 创建一个管理 XtraForms 的服务。
- CreateRibbonWindowService(IWin32Window owner, string title = null) – 创建一个管理功能区表单的服务。
- CreateFlyoutWindowService(IWin32Window owner, string title = null) – 创建一个管理 Flyouts 的服务。
- Create(IWin32Window owner, DefaultWindowServiceType type, string title = null) – 创建一个类型取决于类型参数的服务。
- Create(IWin32Window owner, string title = null, Func<IWindow> factoryMethod = null) – 允许您注册管理自定义表单(实现 IWindowFactory 接口的对象)的服务。
- Create(IWin32Window owner, string title = null, IWindowFactory factory = null) – 接受创建自定义窗口的factory类。
公共服务方法
- Show(object viewModel) – 显示与此 ViewModel 关联的视图。
- Show(string documentType, object viewModel) – 显示由目标 ViewModel 管理的特定视图。
- Show(string documentType, object parameter, object parentViewModel) – 允许您将特定参数传递给表单。
- Hide() and Activate() – 允许您最小化表单,或将其置于最前面。
- Close() – 关闭托管窗口。
DevExpress WinForm | 下载试用
DevExpress WinForm拥有180+组件和UI库,能为Windows Forms平台创建具有影响力的业务解决方案。DevExpress WinForms能完美构建流畅、美观且易于使用的应用程序,无论是Office风格的界面,还是分析处理大批量的业务数据,它都能轻松胜任!
更多产品正版授权详情及优惠,欢迎咨询在线客服>>
DevExpress技术交流群5:742234706 欢迎一起进群讨论

标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!