如何定位(或获取)与 XamGrid 中另一个控件位于同一行的控件?
我正在使用 XamGrid 来允许用户编辑数据。我有几种情况,其中给定可编辑行中的一个控件上的事件处理程序必须使用或定位同一行中的另一个控件。例如,我想处理 ComboEditor
的选择更改,以导致另一个 ComboEditor
中的选择列表发生更改。作为另一个例子,我想要一个选中的复选框来禁用同一行中其他控件的编辑。
我如何找到或获取对同一行中不同控件的引用?通常,每个控件的事件参数不知道其他控件或该控件位于一行中。
I am using the XamGrid
to allow users to edit data. I have several scenarios where the handler of an event on one control in a given editable row must use or target another control in the same row. For example, I want to handle the selection changing of a ComboEditor
to cause the list of choices in another ComboEditor
to change. As another example, I'd like a checked checkbox to disable the editing of other controls in the same row.
How would I find or get a reference to a different control in the same row? In general, each control's event arguments are unaware of other controls or that the control is in a row.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常,在 Silverlight 应用程序中,您可以使用绑定和 ViewModel 对象的组合来执行此操作。因此,对于您的示例,“选中复选框以禁用同一行中其他控件的编辑”。您需要在 ViewModel 上有一个与该行绑定的属性,该属性是一个布尔值。然后,您只需添加到其他列上的只读属性的绑定,并将其绑定到同一属性(您可能必须反转该值)。
Typically in a Silverlight application you would do this using a combination of bindings and a ViewModel object. So for your example a "checked checkbox to disable the editing of other controls in the same row". You would need a property on your ViewModel that the row is bound to that is a bool. Then you would just add a binding to the readonly property on the other columns and bind that to the same property (you might have to reverse the value).