Guilherme
Guilherme

Reputation: 5341

Dispatcher not making a new thread

First, sorry for my english.

I'm making a WPF/C# application, with a Frame and pages.

When I try to change quickly the page displayed, by 4 or 5 times, the program starts to freeze and I need to wait.

I'm forced to use a Dispatcher to make the pages loading in background, so they'll not freeze the entire application. But still freezing. It seems that the dispatcher is not invoking a new thread.

I'm using the following code:

this.Dispatcher.Invoke((Action)(() =>         // BeginInvoke also don't work
{
    Page1 p = new Page1();
    Frame1.NavigationService.RemoveBackEntry();
    Frame1.Content = p;
}));

and still freezing! Any help?

Many thanks.

Upvotes: 0

Views: 112

Answers (1)

Kent Boogaart
Kent Boogaart

Reputation: 178660

I'm forced to use a Dispatcher to make the pages loading in background

That's not forcing them to load on a background thread, it's forcing them to load on the dispatcher's thread.

Upvotes: 3

Related Questions