数据绑定问题(使用MVVM模式)到DataGrid的RowDetailsTemplate中的WPF Combobox [英] Problem with data binding (Using the MVVM pattern) to a WPF Combobox within a DataGrid's RowDetailsTemplate

查看:536
本文介绍了数据绑定问题(使用MVVM模式)到DataGrid的RowDetailsTemplate中的WPF Combobox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图绑定一个视图模型属性到WPF组合框的'SelectedItem'属性。此组合框驻留在DataGrid的RowDetailsTemplate中。绑定部分存在,因为视图模型的属性getter和setter在选择一行时调用一次(因此会使详细信息视图展开)。但是,在后续组合框选择更改时,该属性不会再次调用。它几乎就像数据上下文不是在行详细信息被展开后,或者在显示行详细信息之后解除绑定。很奇怪,我不知道如何让它调用属性的所有选择更改。必须有一种方法。



我知道这个问题是由于combobox在行的细节,但我不知道如何获取它解决了。有人有一个类似的问题吗?任何和我的意思是任何种类的信息或帮助将非常感谢...我花了几天匆匆离开这试图找出为什么它的行为这样。

UpdateSourceTrigger 未设置为 PropertyChanged


I'm trying to bind a view model property to the 'SelectedItem' attribute of a WPF combobox. This combobox resides within a RowDetailsTemplate of a DataGrid. The binding is partially there because the view model's property getter and setter each get called once when a row is selected (And thus causes the details view to expand). However the property never gets called again upon subsequent combobox selection changes. It's almost like the data context is not right after the row details is expanded or the binding is de-coupled after the row details is shown. Very strange, and I can't figure out how to get it to call the property upon all selection changes. There has to be a way.

I know this problem is due to the fact that the combobox is in the row details, but I can't figure out how to get it resolved. Has anybody ever had a problem similar to this? Any and I mean any kind of info or help would be much appreciated ... i've spent a few days hacking away at this trying to figure out why it's behaving this way.

解决方案

Maybe the UpdateSourceTrigger in the Binding is not set to PropertyChanged?

这篇关于数据绑定问题(使用MVVM模式)到DataGrid的RowDetailsTemplate中的WPF Combobox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆