WPF DataGrid - 通过代码动态行详细信息
当用户在网格之外执行操作时,我需要在 WPF DataGrid 中显示 RowDetails。但问题是,我需要能够准确地切换出 RowDetails 将基于的内容。例如,如果单击“添加”,我想在 AddRowDetailControl 类型的行下方显示 RowDetails,如果选择“编辑”,我想在同一行下显示不同的控件。这可能吗?
I have the need to show RowDetails in the WPF DataGrid when the user performs an action outside of the grid. The thing is though, I need to be able to switch out exactly what the RowDetails will be based on that. For example, if the click Add, I want to show RowDetails below Row of type AddRowDetailControl, and if they choose Edit, I would want to show a different control under the same row instead. Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须根据您的要求动态创建 RowDetails 的数据模板。在数据模板内,您可以放置所需的控件。
看看这里:
http://www.codeproject.com/KB/WPF/WPFDataGridExamples.aspx
You'll have to create the datatemplate of your RowDetails dynamically based on what your requirement is. Inside the datatemplate you can put the controls you need.
Have a look here:
http://www.codeproject.com/KB/WPF/WPFDataGridExamples.aspx