void traceOnPropertyChanged(object sender, PropertyChangedEventArgs e) { ThreadPool.QueueUserWorkItem(o => { Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, new Action(() => { if (e.PropertyName == "Trace") { try { foreach (string msg in _trace.Trace) { //TxtAll.AppendText($"{DateTime.Now.ToString(" HH:mm:ss fff")} | {msg}"); TxtAll.AppendText(msg); TxtCurrrent.Text = msg.Replace("\r", "").Replace("\n", ""); } _trace.Clear(); } catch (Exception) { } } })); }); }