-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug
what I did:
- Drawer is inside a tabitem of tabcontrol.
- The drawer control has been opened when I switch tabcontrol to another tab.
- Switch back to the original tab page containing the drawer control.
- Click close button of the drawer.
what I got:
The drawer control is indeed closed, but the mask element is left on the page.
Steps to reproduce the bug
- Drawer is inside a tabitem of tabcontrol.
- The drawer control has been opened when I switch tabcontrol to another tab.
- Switch back to the original tab page containing the drawer control.
- Click close button of the drawer.
Expected behavior
AdornerContainer should also be closed.
Screenshots
NuGet package version
HandyControl 3.4.0
IDE
Visual Studio 2022
Framework type
.Net Framework 4.8
Windows version
Windows 11 (22000)
Additional context
I found a way to fix that by modifying method "OnIsOpenChanged" in drawer.cs.
add:
_container = _layer.GetAdorners(_layer)?.First(c=>c is AdornerContainer) as AdornerContainer;
before
if(_container == null)
{
CreateContainer();
}
at line 305.
BECAUSE:
there is an assignment
_container = null
inside Drawer_Unloaded at line 74 of drawer.cs.
and I think that it's associated with
if(_container == null)
{
CreateContainer();
}
in method "OnIsOpenChanged" at line 305.when I select another tab of tabcontrol,Drawer_Unloaded is invoked,then this assignment makes drawer lose reference to current _container.At the same time,the drawer is not closed!!!
so,if I go back to first tab and click drawer's close button,the "OnIsOpenChanged" will create a new container!Then the previous container was left on the page.
Is it right to do this?