Update:
I've included some diagnostics in the SelectedValue property (diagnostics:PresentationTraceSources.TraceLevel=High
) and I think I can see the issue, although I do not know how to fix it. The diagnostics show
System.Windows.Data Warning: 76 : BindingExpression (hash=16001149): TransferValue - got raw value '3'
System.Windows.Data Warning: 80 : BindingExpression (hash=16001149): TransferValue - implicit converter produced '3'
System.Windows.Data Warning: 85 : BindingExpression (hash=16001149): TransferValue - using final value '3'
System.Windows.Data Warning: 86 : BindingExpression (hash=16001149): **Update - got raw value <null>**
System.Windows.Data Warning: 90 : BindingExpression (hash=16001149): **Update - using final value <null>**
System.Windows.Data Warning: 98 : BindingExpression (hash=16001149): SetValue at level 1 to LookupModelBase (hash=57292143) using ReflectPropertyDescriptor(PK): <null>
System.Windows.Data Warning: 91 : BindingExpression (hash=16001149): Got ValueChanged event from LookupModelBase (hash=57292143)
System.Windows.Data Warning: 85 : BindingExpression (hash=40869743): TransferValue - using final value ObservableCollection`1 (hash=64658589 Count=4)
so the SelectedValue is set to null for some reason.
Has anyone overcome this issue?
Thanks
Hi,
Further to my previous post and to make this a bit clearer than my previous ramblings, I think the question is as follows;
Why would a combobox display be set to blank when another property is amended (due to OnPropertyChanged), even though the actual underlying value is not amended? If I amend a field in the same record the combobox shows as empty, but if I navigate away and back again the value returns?
The xaml is as follows;
ItemsSource="{Binding TrialParentValues, Mode=OneWay}"
SelectedItem="{Binding TrialParentObj, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, Mode=TwoWay}"
DisplayMemberPath="Description"
SelectedValuePath="PK"
SelectedValue="{Binding TrialParentObj.PK}"
Thanks