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

NativeFloatingWindow can't be cleared bug #1

Closed
wuyang26 opened this issue Aug 14, 2017 · 5 comments
Closed

NativeFloatingWindow can't be cleared bug #1

wuyang26 opened this issue Aug 14, 2017 · 5 comments

Comments

@wuyang26
Copy link

wuyang26 commented Aug 14, 2017

with windows10 system,VS2017,and .net 4.5,run the "QuickStart" project ,drag one panel to show a separate window(NativeFloatingWindow object),minimized the main window ,then maximized the main window,drag and drop the separate NativeFloatingWindow to dock,at last the NativeFloatingWindow can't be cleared.
another,
Every time ,drag one panel to show a separate window,and then go back docking,but monitor the visual tree,the NativeFloatingWindow object more and more,it can't be destroid.

@weifenluo
Copy link
Member

A DockItem can have two docking state: docked and floating, you can double click to switch between these two states. Therefore two states must be preserved. For simplicity, the floating window will be hidden instead of being destroyed when all DockItem objects are docked.
The first behavior is definitely a bug, it looks like the data binding between NativeFloatingWindow.Visibility and FloatingWindow.IsVisible are broken (Line 29-34 in NativeFloatingWindow.xaml).

@weifenluo
Copy link
Member

OK, the root cause is when min/max window, the Window.Visibility dependency property is set with a local value, therefore breaks the data binding.

To verify, add a Debug.WriteLine at NativeFloatingWindow.cs line 150:

                case WM_NCLBUTTONDOWN:
                    Debug.WriteLine(string.Format("FloatingWindow.IsVisible={0}, this.Visibility={1}, this.Visibility.LocalValue={2}", FloatingWindow.IsVisible, this.Visibility, this.ReadLocalValue(VisibilityProperty)));

This will output debug info when clicking the window caption.
Output before window min/maxed:

FloatingWindow.IsVisible=True, this.Visibility=Visible, this.Visibility.LocalValue={DependencyProperty.UnsetValue}

Output after window min/maxed:

FloatingWindow.IsVisible=True, this.Visibility=Visible, this.Visibility.LocalValue=Visible

@wuyang26
Copy link
Author

wuyang26 commented Aug 14, 2017 via email

@wuyang26
Copy link
Author

Another,with the .NET 4.5 update ,the project "WindowDockSample" compile error.

weifenluo added a commit that referenced this issue Aug 14, 2017
weifenluo added a commit that referenced this issue Aug 14, 2017
@weifenluo
Copy link
Member

Thanks for reporting the bug. It's been fixed and this issue is closed.

I can't reproduce the compile error, please open another issue with detailed error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants