private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (fromBit != null) { Histogram.GenerateHistograph(fromBit); fromBit = null; } Channels.SelectedIndex = 0; inputFromUser = false; Task.Delay(10).ContinueWith(t => { App.Current.Dispatcher.Invoke(() => { Histogram.BuildHistogramImage(); }); }); }