开发者

Problem with data binding (Using the MVVM pattern) to a WPF Combobox within a DataGrid's RowDetailsTemplate

开发者 https://www.devze.com 2023-01-06 11:12 出处:网络
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 t

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. The开发者_StackOverflowre 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?

0

精彩评论

暂无评论...
验证码 换一张
取 消