0

I'm in the process of re-writing a WinForms app in WPF and I've run into section of code that updates a textbox (from another thread). In a nutshell, the function that updates the textbox looks like this:

    // tbStatus is the textbox, of course
    if ((tbStatus != null) && (!tbStatus.IsDisposed) && (!tbStatus.Disposing))
    {
        tbStatus.AppendText(text + Environment.NewLine);
    }

I'm somewhat new to WPF and I don't see .IsDisposed or .Disposing properties on the WPF textbox. Is there another way to determine that a WPF control hasn't been disposed before attempting to access it?

Joe Korolewicz
  • 474
  • 4
  • 21
bmt22033
  • 6,880
  • 14
  • 69
  • 98
  • 1
    `I'm in the process of re-writing a WinForms app in WPF` - Please read [this](http://stackoverflow.com/a/15684569/643085) before you type a single line of code. – Federico Berasategui Jul 16 '13 at 17:56
  • 1
    You don't `update a TextBox from another thread` in WPF. you create a proper data model and do `DataBinding` and let the `DataBinding` update the UI accordingly. Please read the linked article. All your winforms code will most probably be useless in WPF. WPF is about `DataBinding`, not code-behind boilerplate. – Federico Berasategui Jul 16 '13 at 17:58

0 Answers0