During construction of one of the View models for a Windows Phone 8.1 WinRT application, I have a call to DispatcherHelper.CheckBeginInvokeOnUI
I initialize DispatcherHelper
during runtime at App.xaml.cs OnLauched event handler, but during design time this initialization is not done so when I call DispatcherHelper.CheckBeginInvokeOnUI
, I get an Exception with the message "The DispatcherHelper is not initialized"
Is there any way to avoid this issue during design time other than calling DistpatcherHelper
conditionally, checking ViewModelBase.IsInDesignMode
first?
As mentioned in the question, one possible way to avoid this issue is checking whether we are in design mode first as done in this gist: