JWP
JWP

Reputation: 6963

WPF what happened to the dispatcher object on UI elements?

Many years ago I was easily able to invoke the dispatcher on any UIElement simply like this.

MyWPFTextBox.Dispatcher.Invoke...

Either my intellisense isn't working or it's been moved.... because no Dispatcher property appears now. Anybody know, how do I get addressibility to dispatcher from XAML element?

Upvotes: 2

Views: 159

Answers (3)

JWP
JWP

Reputation: 6963

Solution: Intellisense was busted per suggestion from Omega man above, once I reset the settings in his post everything worked as it should.

Upvotes: 1

ΩmegaMan
ΩmegaMan

Reputation: 31676

Verify that the Statement Completion section for the language of the text editor is checked for Auto list members. I turn it on for all languages globally.

I show this on my blog article:

Visual Studio Fix: Intellisense Not Popping Up or Not Working

Upvotes: 1

BradleyDotNET
BradleyDotNET

Reputation: 61369

As of .NET 4.5, it's still there (even in intellisense), so I'm guessing your Intellisense is currently busted.

A few things to note:

  • You usually use the async version BeginInvoke in current WPF
  • Having to marshal actions to the UI thread means you are probably doing it wrong. A proper binding setup will marshal your changes correctly with no extra effort.
  • You don't need to use Dispatcher on a specific control, the one on your root UI element will suffice (ie, just Dispatcher.BeginInvoke)

Upvotes: 2

Related Questions