-
Notifications
You must be signed in to change notification settings - Fork 308
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
Why is LayoutAnchorable.Parent set to PreviousContainer on hiding? #141
Comments
Hi, I am not sure I am understanding your question. The current version of
|
Hi @Dirkster99, As a start I just wanted to understand the reason behind adding that part to
Excuse me if I'm wrong but the commit you're mentioning above is a change to other place in |
I realized that I've been missing a step in the history of the My problem is that I am not the original author of AvalonDock and so I am having trouble to always understand and test all side-effects - partly because there are so many different options (using MVVM, WinForms, Binding Properties can behave differently ...) and partly because there was almost no in code documentation that was worthwhile to speak of when I took over this project. I've tried to change the in-code documentation issue with the help of @mkonijnenburg but there are still some details like the PreviousContainer property that I don't fully understand, yet. So far, we understand that the PreviousContainer property can be used to remember the Parent as previouscontainer for re-instation later. This can be used to check if an item was the last one in the parent, it can move itself up in the layout tree by setting previouscontainer to it's grandparent (a LayoutPanel), by assumption that the parent will be garbage collected. What I don't understand, yet, are the workflows (serializing/deserializing layout and using Hide and maybe others?) and the expected behavior. It would be really great if we could fill this gap and I would be happy to roll the above change back if you could tell me how your code relies on the PreviousContainer property being null (when being hidden?) |
Hi Dirk, sorry for delayed reply and thank you for throwing some light on it. It seems I must have missed mentioning of #28 in your previous comment. It is actually where that change to |
Hi Boris, thanks for your feedback. But would your problem not be solved if we set:
inside UpdateParentVisibility() ? I think rolling back to this version seems to be advisable since the change in PR #32 was rather technical and does not seem to cover all cases correctly (Hide). Would you agree? Would this change solve your problem? |
Hi Dirk, the original code in
I did not insist you to revert the code in your fork as it seems to fix what is described in #28 and #32. We do some other stuff in our project/branch to allow for floating tool/anchorable windows to be hidden and reopen. For example we change Close button to execute HideCommand instead of CloseCommand in case of an achorable. I can prepare push request if you like but not sure how useful it will be in general case. |
Hi Boris, whether to Hide or to Close is actually an interesting question. I came across the same in issue #71 where I am thinking that Hide is more appropriate than Close since it is more consistent. I just don't see why this is inconsistent to the MainWindow docked behavior of LayoutAnchorables. Would you also advocate for Hide in the case of #71? If yes, do you happen to know a good way for re-aligning the Close command into Hide for this DocumentPane case? I think the PR for the floating window anchorable sounds interesting because it could make all 3 LayoutAnchorable places (LayoutAnchorable Docks in MainWindow, DocumentPane, and Floating Window) consistent :-) Drk |
Hi Boris, I was wondering if you are still willing to prepare the PR to change the CloseCommand into a Hide command and whether (for consistency sake) we should not do the same with issue #71? |
Hi Dirk, sorry for not answering lately but I've been busy on other tasks. I plan to be back on AvalonDock integration in our project as part of it I will try to prepare PR with changes that we did regarding docking anchorables in document area. I will have a look at what happens in #71, if we have experienced the same and if so how we have solved it. |
I tried to verify your problem about the IsHidden property changed being raised multiple times so I added the Debug.WriteLine below line in LayoutAnchorable.cs and I can see only one change per Anchorable being hidden. If you have a special case for this maybe we should open a separate issue for this? We could also include an event for this?
|
Correct me if I am wrong but with that code you actually check the number of Hide() calls per anchorable and not the number of IsHidden property change notifications that occur while hiding. As I said before we react on IsHidden property changed in our code and it fails because it expects Parent to be null when hidden. |
You are of course correct. I assumed that all hidden changes should go through this method :-( maybe we should open a separate issue for this with a small demo app exibiting the problem in the client so we can solve this problem and make sure there is only 1 IsHidden property change notification per Hidden process... |
Shouldn't it be that the Parent is set to null when detaching/hiding?
I can't see in history when and why have you changed that.
(see LayoutAnchorable.UpdateParentVisibility() for reference)
The text was updated successfully, but these errors were encountered: