I have discovered an issue when attempting to register regions while using PRISM without an Application.Current set. This occurs when launching a WPF window through COM from an unmanaged application and as far as I can tell there is no way to set the Application.Current
without launching a whole new application.
The reason this not being set causes issues is because the check to determine whether you are in design mode checks the Application.Current is not null which was apparently done to compensate for a known issue in "Cider".
The following code snippet shows the area which i am referring to:
private static bool IsInDesignMode(DependencyObject element)
// Due to a known issue in Cider, GetIsInDesignMode attached property value is not enough to know if it's in design mode.
return DesignerProperties.GetIsInDesignMode(element) || Application.Current == null || Application.Current.GetType() == typeof(Application);
If you rely on GetIsInDesignMode only then Regions can register. Our current solution for this is to modify the library and rebuild it, however this is not ideal.
Can anyone think of a better solution to this that doesn't involve launching a whole new application, or modifying the PRISM libraries.