Have a bit of an odd situation. I have two AutoCompleteBoxes. Both are bound are in a near-identical manner, the only difference being that the 2nd one is bound to a filtered view of the data bound to the 1st box:
Box 1: ItemsSource="{Binding SearchRecords}" DisplayMemberPath="SearchValue" SelectedItem="{Binding SearchBox1SelectedItem, Mode=TwoWay}"
Box 2: ItemsSource="{Binding SearchRecords2View}" DisplayMemberPath="SearchValue" SelectedItem="{Binding SearchBox2SelectedItem, Mode=TwoWay}"
After the second selection is made, I take some query actions, which work correctly. I then attempt to blank both boxes to clear the slate for the next user action:
SearchBox1SelectedItem = null;
SearchBox2SelectedItem = null;
Both property setters handle this in the same way:
if (_searchBox1SelectedItem != value)
{
_searchBox1SelectedItem = value;
RaisePropertyChanged();
}
if (_searchBox2SelectedItem != value)
{
_searchBox2SelectedItem = value;
RaisePropertyChanged();
}
The effect on the SearchBox1 is as expected, i.e. the box clears itself, as shown in its properties as per AutoCompleteBox1.jpg, attached.
But this does not happen as expected for SearchBox2. Instead, it seems to have made an aborted attempt to clear itself, as per AutoCompleteBox2.jpg. Note how the SelectedItem value for SearchBox2 has been nullified, as intended, but it retains 1 record in its SelectedItems list, and also note how its SearchText, which is set to "Bil", should in fact be "Billy Joel", which is what still appears in the Search Box.
Any ideas?