I have a wpf UserControl that handles events from a ComboBox. The control subscribes to the ComboBoxes' DropdownClosed event. I'm facing the problem, that the Combobx base implementation peforms unpleasant default code, after running through the handler.
I like to know if there's a way to simply place my code, "synchronous" after the handler finished.
I found out a common way is using BeginInvoke:
void OnComboBoxDropDownClosed()
{
...
Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => MyCodeAfterHandlerFinished()));
}
I don't think i need this (because msdn tells me it runs asynchronously), What is best practice ?
more explained: 1) get notified when DropDownClosed() is fired by the ComboBox base (This event can be seen as the condition for "MyCode()") 2) wait until the ComboBox base implementation has run through all its invocation list and has dispatched all its event subscribers. 3) run MyCode() --> how place MyCode using Invoke / BeginInvoke ?