I have a problem with some binding, I have ObservableCollection
of strings with all my combobox dropdown items. It should be possible to either select a value from the dropdown menu or insert some text manually or combine both methods.
<ComboBox ItemsSource="{Binding AvailableAddressSymbols}"
Text="{Binding SelectedItem.LowerBound,
ElementName=combobox_sys_data_protection}"
HorizontalAlignment="Right"
IsEditable="True"
DropDownOpened="SymbolAddressRefress_Dropdownopend" />
<ComboBox ItemsSource="{Binding AvailableAddressSymbols}"
Text="{Binding SelectedItem.UpperBound,
ElementName=combobox_sys_code_protection}"
IsEditable="True"
DropDownOpened="SymbolAddressRefress_Dropdownopend" />
I'm binding to the text property of that combobox to allow manually written text. Everything works fine, but I have more than one of these comboboxes. The available Items for the combobox get refreshed on drop down opened.
Now here comes the problem: When I select a value in combobox1 and I want to select a value in combobox2 then the vaule from combobox1 is set to " ";
The refresh clears the itemlist and adds the new values, I think here is the problem but I need to refresh it because there will maybe new values.
internal void refreshAvailableAddressSymbols()
{
AvailableAddressSymbols.Clear();
for (int i = 0;
i < Database.ProjectConfiguration.AddressSymbols.Count;
i++)
{
AvailableAddressSymbols.Add(
Database.ProjectConfiguration
.AddressSymbols[i].StartAddress);
AvailableAddressSymbols.Add(
Database.ProjectConfiguration
.AddressSymbols[i].EndAddress);
}
}