如何在 WPF 中禁用网格内的选项卡功能
我的要求相当棘手(在我看来)。 我将解释这个场景。
我有一个数据网格。在 DataGrid 中,我有两列,这两列的每个单元格中都有一个网格,其中有两个组合框 - 目的是根据某些条件切换可见性。
当我们在组合框中选择一个值时,组合框本身以及其他列中的一些其他控件将被禁用(pjt 的要求)。现在还有另一个要求,例如,在禁用控件的单元格中不允许使用 Tab - 例如禁用组合框。
我们根据组合框中选定的值将控件设置为“启用”或“禁用”。因此,由于我们在控件级别应用禁用属性,并且 IsTabStop 属性位于单元格级别,因此我无法限制在禁用控件的单元格中进行 Tab 键切换。
有什么想法吗?
My requirement is rather a tricky one (it seems to me).
I will explain the scenario.
I have a DataGrid. In the DataGrid, I have two columns in which I have a grid in every cell of these two columns, inside of which, there are two comboboxes - the purpose being to switch the visibility based on some conditions.
When we select a value in the combobox, the combobox itself, plus some other controls in some other columns will get disabled (requirement of the pjt). Now there is also, another requirement like, Tab should not be allowed in the cell which has disabled controls - say disabled combobox.
We are setting the controls as Enabled or Disabled based on a selected value from the combobox. So, since we are applying the disabling property on the control level, and the IsTabStop property is on the cell level, I am not able to restrict Tabbing in the cells having disabled control.
Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要使用数据网格。
DataGrid 对于只读内容来说非常棒,但是对于进行任何类型的有趣编辑来说它们似乎很糟糕。经过一周多的斗争,我已经放弃了。
现在我正在寻找替代品,它最终可能只是一个带有手动添加控件的可滚动堆栈面板。
WPF:是否有一个不带能够选择项目吗?
Don't use a DataGrid.
DataGrid's are awesome for read-only stuff, but they seem to suck for doing any kind of interesting editing. After well over a week of fighting with it, I've given up on it.
Right now I'm looking for a replacement, which may end up just being a scrollable stack panel with manually added controls.
WPF: Is there a "ListBox" without the ability to select items?