In this lesson, you will learn how to change the UI Type of the WinForms application. By default, the Solution Wizard enables the Multiple Document Interface (MDI). You can change this setting via the Model Editor, or in code. For example, you can select Single Document Interface (SDI) for your application.
在本课中,您将学习如何更改 WinForms 应用程序的 UI 类型。默认情况下,解决方案向导启用多文档接口 (MDI)。您可以通过模型编辑器或在代码中更改此设置。例如,可以为应用程序选择单个文档接口 (SDI)。
Follow the steps below to change the UI Type of your WinForms application using the Model Editor:
按照以下步骤使用模型编辑器更改 WinForms 应用程序的 UI 类型:
-
Invoke the Model Editor by double-clicking the Model.xafml file from the MySolution.Win project. Navigate to the Options node. This node allows you to edit different UI settings of the application. In the UIType property's dropdown list, select the desired option, for example, SingleWindowSDI.
-
通过双击 MySolution.Win 项目中的 Model.xafml 文件来调用模型编辑器。导航到选项节点。此节点允许您编辑应用程序的不同 UI 设置。在 UIType 属性的下拉列表中,选择所需的选项,例如,单窗口SDI。
-
Run the WinForms application. Ensure that the SDI is enabled, as illustrated in the image below.
- 运行 WinForms 应用程序。确保启用 SDI,如下图所示。
- In SDI mode, each invoked View appears within a single window that replaces the previous one.
-
在 SDI 模式下,每个调用的视图都会在替换前一个窗口的单个窗口中显示。
Note 注意
If you have selected MDI, you can customize its behavior in the Model Editor using the Options node's MdiDefaultNewWindowTarget property.
如果选择了 MDI,则可以使用选项节点的 MdiDefaultNewWindowTarget 属性在模型编辑器中自定义其行为。
To learn how to change the UI Type in code, refer to the WinApplication.ShowViewStrategy topic If you change the UI Type in code, changes made to the UIType property value in the Model Editor's Options node will be ignored.
要了解如何更改代码中的 UI 类型,请参阅 WinApplication.ShowViewStrategy 主题 如果更改代码中的 UI 类型,将忽略对模型编辑器选项节点中的 UIType 属性值所做的更改。
In the Main Demo, a separate WinForms project is created to demonstrate the MDI. The MainDemo application is installed in %PUBLIC%DocumentsDevExpress Demos 19.2ComponentseXpressApp FrameworkMainDemo by default. The ASP.NET version is available online at http://demos.devexpress.com/XAF/MainDemo/
在主演示中,将创建一个单独的 WinForms 项目来演示 MDI。主演示应用程序安装在%PUBLIC%DocumentsDevExpress Demos 19.2ComponentseXpressApp FrameworkMainDemo by default. The ASP.NET version is available online at http://demos.devexpress.com/XAF/MainDemo/
.