主/详细 UI 最佳实践?
我们有一个 WPF 应用程序,它有一个主窗口/详细窗口窗口,两者都是 WPF 数据网格。当您在上部数据网格中选择一行时,详细信息将显示在下部数据网格中。我想知道从 UI 角度来看是否有任何最佳实践来处理以下问题:
- 当窗口首次打开时,上部数据网格中没有选择数据行,因此下部网格中无法显示任何数据。这是正常的吗?或者通常在上部数据网格中选择初始(顶部)行?
- 当选择一行然后删除时,另一行是否会成为所选行?或者您要进入无行选择状态吗?
- 如果可以选择多行,那么下部数据网格什么时候发生?显示最后选择的一项?或者如果对这多个对象选择删除,焦点设置在哪里?或者说选择的是哪一行?
我知道根据应用程序的编写方式,可以有很多不同的方式来处理这些事情,但我想知道是否有一些标准的最佳实践?或者 WPF 数据网格是否有一些默认操作可以处理这些情况?
谢谢! 账单
We have a WPF app that has a master/detail window, both being WPF Datagrids. When you select a row in the upper datagrid, the details are shown in the lower datagrid. I was wondering if there are any best practices from a UI perspective on how to deal with things such as:
- When the window first opens, no datarow is selected in the upper datagrid, and so no data can be displayed in the lower grid. Is this normal? Or is there typically an initial (top) row selected in the upper datagrid?
- When a row is selected and then deleted - does another row become the selected row? Or are you going to go to a no row selected state?
- If multiple rows can be selected, when happens in the lower datagrid? Show the last one selected? Or if delete is selected for these multiple objects, where is focus set? Or what row is selection?
I know there are a lot of different ways these things might be handled depending on how the app is written, but I wondered if there is some standard best practices? Or if there is some default operations for how the WPF datagrid might handle these cases?
thanks!
Bill
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为前两个考虑因素可以归结为偏好。我希望在窗口首次打开时选择第一行并显示其详细信息 - 这告诉我,作为用户,该窗口是如何工作的。不确定它在 WPF 中如何工作,但在 Windows 窗体中,datagridview 默认情况下预先选择了顶行(要让它停止这样做需要技巧)。
当我删除一行时,我个人更喜欢进入“未选择行”状态,但在“这就是你应该这样做的原因”方面,我没有太多支持。我只是喜欢看到空的“详细信息”视图和缺乏选择来确认我确实成功删除了所选行。
不过,我认为最后一点更为明确。如果视图中存在主/从关系,则不应允许多重选择。如果您需要用户能够对主网格视图的多行执行操作,您可以向这些行添加一些复选框,以允许用户选择要执行操作的行子集。但为了显示详细信息,一次只能选择一行。
I think the first two considerations can come down to preference. I'd prefer to have the first row selected and its details shown when the window first opens -- this tells me, as a user, how this window works. Not sure how it works in WPF, but in Windows Forms, the datagridview pre-selected the top row by default (and getting it to stop doing that requires tricks).
When I remove a row, I personally prefer to go to a "no row selected" state, but I don't have much to back that up with in terms of "this is why you should do it". I just like seeing the empty "detail" view and lack of selection as confirmation that I did successfully remove the selected row.
The last point, however, I think is more clear-cut. If you have a master/detail relationship in views, you should not allow multiple selection. If you need the user to be able to perform actions on multiple rows of the master gridview, you can add some checkboxes to the rows to allow the user to pick a subset of rows to act on. But for the purposes of showing details, only one row must be selected at a time.