views:

37

answers:

1

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.

A: 

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

HCL
Is that an attribute that I can set in my xaml code? It's not available on the combobox in xaml.
BrianP
Somewhere you have probably something like <ComboBox SelectedItem="{Binding MVProperty}"/> where MVProperty is the name of the property that you bind to. Extend this to something like: <ComboBox SelectedItem="{Binding MVProperty,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>. If the problem lies in the binding, that should fix it.
HCL
AMAZING!!!!!!!!!!!!! 1000 thank you's! i've been googling high and low to fix this problem, and finally you've provided the answer that fixed my problem. Now I get the setter called everytime I change the selection. Thanks!
BrianP
You're welcome. Please Upvote my answer to give me some points that I can invest to start a bounty in a critical moment.
HCL
I would, but the up vote requires '15' reputation, which I don't have .... yeah, i'm that new to StackOverflow - LOL!
BrianP