开发者

Combobox binding in dataform with MVVM not firing PropertyChanged

I've got a dataform bound to an ObservableCollection<Model.Parameters> Parameters object in my View Model. In my editTemplate, the left column is bound to properties within the Parameters object. The right column is a series of ComboBoxes. The binding for each is set up like this:

<toolkit:DataField>
  开发者_开发知识库  <telerik:RadComboBox
    ItemsSource="{Binding DataSource.Accounts, Source={StaticResource DataContextProxy}}"   
    SelectedValue="{Binding HWIPInstall, Mode=TwoWay}"
    Width="150"
    Margin="0 0 20 0">
    </telerik:RadComboBox>
</toolkit:DataField>

As you can see, I'm binding the ItemsSource to a ObservableCollection called Accounts, which is simply a list of Accounts populated on load in my VM. The SelectedValue is then bound to (in this case) the HWIPInstall property of my Parameters Object. When I toggle between my ReadOnlyTemplate (which is a series of Textboxes only [no combo] bound directly to my Parameters Object) and my EditTemplate, the comboboxes properly display a list of Accounts. The SelectedValue is also set correctly. However, when I change a combobox, it doesn't seem to fire INotify, because my 'OK' button on my dataform doesn't change. However, If I change a textbox, the 'OK' button lights up, and my SaveParameters method is called.

A note on the above. If I set a breakpoint on my SaveParameters method, I can see my Parameters object has updated both the textbox changes, AND the combobox changes, so I know my Parameters object is being updated when the combobox changes, yet none of these changes fire iNotify.

Your thoughts?


Wow duh. I was using automatic properties on my model. My ViewModel implements INotify, but my Model wasn't.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜