Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlatformModeDetector.InDesignMode() not working in WPF designer for nested UserControls #819

Open
wldevries opened this issue Nov 10, 2021 · 0 comments
Assignees
Labels

Comments

@wldevries
Copy link

wldevries commented Nov 10, 2021

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:

  1. Create UserControlA with an OnLoaded event handler guarded by PlatformModeDetector.InDesignMode() throwing an exception when left through
  2. Create UserControlB that has UserControlA hosted somewhere within it
  3. 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.

@dpvreony dpvreony self-assigned this Nov 11, 2021
@dpvreony dpvreony added the Bug label Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants