I have a WPF window with a ListBox
, that is bound to a public ObservableCollection<String>
, that is being updated by another thread (BackGroudWorker
).
<ListBox Name="ListBox"
ItemsSource="{Binding MyCollection}"
... />
In the same window I have a Button
with click handler:
<Button Content="Close"
Click="Button_LogWindow_closeButton_Click"
... />
This handler usually not called when I click the button while the ListBox is being updated. Although it works perfectly when the background thread has finished and the ListBox
is not being updated any more.
This looks to me like the button click event is being removed from the queue before it's handler can be called. Am I right?
Do you know how to fix this?