I've got a ComboBox that's giving me grief in WPF using the MVVM pattern

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-05-01T00:41:46Z Indexed on 2010/05/01 0:47 UTC
Read the original article Hit count: 410

Filed under:
|
|
|
|

Here's my code:

<ComboBox Grid.Column="1" Grid.Row="9" ItemsSource="{Binding Path=PriorityEntries}" SelectedItem="{Binding Path=Priority,Mode=TwoWay}"/>

The comboBox is bound properly with PriorityEntries, and when i change the value of the comboBox the "set" of the bound property(Priority) is called setting it to what it needs to be. However, when i close the UserControl that this combobox resides, it calls the set property again with a value of null and then sets what the selectedItem was to null. Why is the comboBox being bound again when I close the usercontrol. I tried setting the mode to OneTime, but that won't reflect any changes...

© Stack Overflow or respective owner

Related posts about mvvm

Related posts about wpf