-
-
Notifications
You must be signed in to change notification settings - Fork 142
Open
Labels
Description
Describe the bug
PlatformModeDetector.InDesignMode()
returns incorrect information when used in controls that are used within a control you are working on in the WPF designer.
Steps To Reproduce
Provide the steps to reproduce the behavior:
- Create
UserControlA
with anOnLoaded
event handler guarded byPlatformModeDetector.InDesignMode()
throwing an exception when left through - Create
UserControlB
that hasUserControlA
hosted somewhere within it - Observe the WPF designer with Control display option: Show all controls
Expected behavior
Designer works
Screenshots
Designer shows an error with a stacktrace leading up to the exception created in step 1 in the OnLoaded
event handler.
Environment
- OS: Windows 10
- Version: 21H1
- Device: x64
- Splat: 13.1.42
Additional context
The built in WPF method DesignerProperties.GetIsInDesignMode(this)
just works, when that is used instead in the event handler of UserControlA
things that should not be run in design mode are skipped.