DevExpress控件使用交流,DevExpress中国社区Dev联系电话 联系电话:023-68661681

DevExpress WinForm控件入门指南:标准DevExpress服务 - Window Service

来源:   发布时间:2022-02-23   浏览:900次

DevExpress Services将命令从ViewModel传递到View中的控件,这允许您在不分离应用程序层的情况下修改 UI。

获取工具下载 - DevExpress v21.2

Window Service

允许您将视图显示为独立的窗口(窗体),并从 ViewModel 层管理这些窗口。

接口

IWindowService

托管控件

全局注册

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      欢迎一起进群讨论

更多DevExpress线上公开课、中文教程资讯请上中文网获取

DevExpress企业定制服务
本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/2917.html

相关产品: DevExpress Universal Subscription,

在线
客服
微信
QQ 电话
023-68661681
返回
顶部