Make a List View Editable 使列表视图可编辑
In this lesson, you will learn how to make a List View editable. For this purpose, the DemoTask List View will be used.
在本课中,您将学习如何使列表视图可编辑。为此,将使用演示任务列表视图。
Note 注意
Before proceeding, take a moment to review the following lessons.
在继续之前,请花点时间复习以下课程。
- Set a Many-to-Many Relationship
- Place an Action in a Different Location
-
Invoke the Model Editor for the MySolution.Module project. Navigate to the Views | MySolution.Module.BusinessObjects | DemoTask_ListView node. It defines the List View that is used for DemoTask objects with the properties to the right. In the AllowEdit property's dropdown list, select "True". When this property is set to "True", the List View is editable.
-
设置多对多关系
-
将操作放置在其他位置
-
调用 MySolution.模块项目的模型编辑器。导航到视图 |My解决方案.模块.业务对象 |DemoTask_ListView节点。它定义用于右侧属性的 DemoTask 对象的列表视图。在"允许编辑"属性的下拉列表中,选择"True"。当此属性设置为"True"时,列表视图是可编辑的。
When List Views are displayed in edit mode, you can apply the NewItemRow functionality of the XtraGrid that displays ListViews in XAF applications. This functionality allows end-users to create new objects directly in a List View without a Detail View. To add this functionality, set the NewItemRowPosition property to Top or Bottom.
当列表视图以编辑模式显示时,您可以应用 XtraGrid 的"新建项目"功能,该功能在 XAF 应用程序中显示 ListViews。此功能允许最终用户直接在列表视图中创建新对象,而无需详细信息视图。要添加此功能,将"新建项目"属性设置为顶部或底部。
Tip 指示
In ASP.NET applications, there are several modes for editing. To set the required mode, use the IModelListViewWeb.InlineEditMode property in the Model Editor invoked for the MySolution.Module.Web project. Various edit modes are illustrated in the List View Edit Modes topic (ASP.NET-Specific Functionality section).
在ASP.NET应用程序中,有多种编辑模式。要设置所需的模式,请使用为 MySolution.module.Web 项目调用的模型编辑器中的 IModelListViewWeb.inlineEditMode 属性。"列表视图编辑模式"主题(ASP.NET特定功能)部分说明了各种编辑模式。
-
Run the WinForms or ASP.NET application and edit one of the DemoTask objects within the List View.
- 运行 WinForms 或ASP.NET应用程序,并在列表视图中编辑"演示任务"对象之一。
- To edit one of the DemoTask objects in an ASP.NET application, click Edit(
) or click New(
) to create a new Task.
- 要编辑ASP.NET应用程序中的一个 DemoTask 对象,请单击"编辑(InlineEdit_EditButton)"或单击"新建(InlineEdit_NewButton)"以创建新任务。
-
To edit one of the DemoTask objects in an ASP.NET application, click Edit(InlineEdit_EditButton) or click New(InlineEdit_NewButton) to create a new Task.
- 要编辑ASP.NET应用程序中的一个 DemoTask 对象,请单击"编辑(InlineEdit_EditButton)"或单击"新建(InlineEdit_NewButton)"以创建新任务。
In a WinForms application, to save the changes made to an object, click the Save () or SaveAndClose (
) button on the toolbar. To cancel the changes, click the Cancel (
) button.
在 WinForms 应用程序中,要保存对对象所做的更改,请单击工具栏上的"保存(btn_Save)或保存关闭(btn_SaveClose)按钮。要取消更改,请单击"取消(btn_Cancel)"按钮。
In the ASP.NET application, to save changes, click Update (). To cancel the changes, click Cancel (
).
在ASP.NET应用程序中,要保存更改,请单击"更新(btn_Save)。要取消更改,请单击"取消(btn_Cancel)。
Note 注意
You can set the edit mode in code. To do this, apply the DefaultListViewOptionsAttribute attribute to the DemoTask class.
您可以在代码中设置编辑模式。为此,请将"默认列表视图选项属性"属性应用于演示任务类。
To see the changes made in this lesson, invoke the Model Editor for the Main Demo's MainDemo.Module, MainDemo.Module.Win and MainDemo.Module.Web projects. The MainDemo application is installed in %PUBLIC%\Documents\DevExpress Demos 19.2\Components\eXpressApp Framework\MainDemo by default. The ASP.NET version is available online at http://demos.devexpress.com/XAF/MainDemo/
要查看本课中所做的更改,请调用主演示 MainDemo.模块、MainDemo.module.win 和 MainDemo.module.Web 项目的模型编辑器。主演示应用程序安装在%PUBLIC%\Documents\DevExpress Demos 19.2\Components\eXpressApp Framework\MainDemo by default. The ASP.NET version is available online at http://demos.devexpress.com/XAF/MainDemo/
.
XAF开发成品案例参考
如果您觉得阅读本文对您有帮助,请点一下“推荐”按钮,您的“推荐”将是我最大的写作动力!欢迎各位转载,但是未经作者本人同意,转载文章之后必须在文章页面明显位置给出作者和原文连接,否则保留追究法律责任的权利。
作者博客: http://www.cnblogs.com/foreachlife
欢迎加入CIIP框架\XAF技术应用交流群: 336090194 群文件中有更多相关工具及文档资料
转载请注明出处。多谢!
欢迎加我微信: admiralcn 或扫码:

【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· 周边上新:园子的第一款马克杯温暖上架
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
· 使用C#创建一个MCP客户端