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

After Modified screen dpi,Unloaded/Loaded is trigged unexpectedly #2255

Open
Kybs0 opened this issue Nov 28, 2019 · 0 comments
Milestone

Comments

@Kybs0
Copy link

@Kybs0 Kybs0 commented Nov 28, 2019

When I modify the system dpi in screen setting, a userControl in window raises unload event, as more amazing unload event of window that contains the userControl is not triggered.

As all I known, loaded/unloaded can be triggered by these cases:
FrameworkElement raises loaded/unloaded when it's added/removed to visual tree.
TabControl selection change from tab A to tab B, raise A'UnLoaded and B'Loaded
Expander、MenuItem and so on...All these cases, emmm.. seems like loaded/unloaded event raises just as element or it's parent leave from or add to wpf visual tree.

But, How Unloaded/Loaded can be raised by changing screen dpi ?
For testing, I create a window, then create and add a simple UserControl named A in window xaml, continue to create and add UserControl named B in A xaml. After window is showed in screen, modify screen dpi from 100% to 150%, UserControl A raise unloaded event, then UserControl B raise unloaded. As joking, window itself has no unloaded.
unloaded event stack:
image
As additional, before modify dpi setting, drag window and move near the taskbar, the issue occurs more probabily~
image

More details please see my blog https://www.cnblogs.com/kybs0/p/11943313.html
Expecting you advise for this bug~

@arpitmathur arpitmathur added this to the Future milestone Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.