frank001
frank001

Reputation: 9

InitializeComponent asynchrounously

Is it possible to make asynchronous InitializeComponent? Otherwise could I load my WPF component asynchronously? More specifically I'm currently developping a product in WPF and I noticed that the loading time of graphical components (some components) is quite big when I have performance requirements.

Upvotes: 0

Views: 1881

Answers (1)

user5447154
user5447154

Reputation:

If you create a component on the UI thread so there's no way to put InitializeComponent on another thread, but it can be called asynchronously in the same thread using Dispatcher.BeginInvoke as follows:

Dispatcher.BeginInvoke(new Action(() =>InitializeComponent()));

Upvotes: 0

Related Questions