I have a editable combo box that looses value if the item source is changed such that the current selected item is removed from item source.
The code is a s follows,
<ComboBox x:Name="TableNameCombo"
MinWidth="100"
IsEditable="True"
ItemsSource="{Binding TableNames}"
SelectionChanged="TableNameCombo_SelectionChanged"
Text="{Binding TableName,
ValidatesOnDataErrors=True,
UpdateSourceTrigger=PropertyChanged}" />
If i am in differnent view when the Item source is changed, the value is retained. The value is lost only if the itemsource is changed when the view with combobox is active.
Please help me with how to retain the combobox value even if it is not present in itemsource and the item source changes when the view comtaining combobox is active
Note:
1.By view i mean i have a tabbed panel and have diferent view in all tabs.
2.I am not talking about any fall back value. I just want to retain whatever the selected value was, even if it is not present in combo box item source.
Let me clear up the question to very simple requirement, This is my screenshot from sample applicaiton,
When the user enter an item in text box and clicks remove item button the item is removed from the collection which is itemSource for Combobox. But when i do that the item is not displayed in combobox.
My requirement is to still retain the item in combobox even though it is not in the collection.