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 closing all documents, new document won't open #321

Closed
BAndysc opened this issue Mar 7, 2024 · 6 comments · Fixed by #322
Closed

After closing all documents, new document won't open #321

BAndysc opened this issue Mar 7, 2024 · 6 comments · Fixed by #322

Comments

@BAndysc
Copy link
Contributor

BAndysc commented Mar 7, 2024

After all documents are closed, new documents won't show up, despite being added to the Dock model.

Screen.Recording.2024-03-07.at.17.24.23.mov

Please note this is not a bug in the sample, I have the same issue in my app.

(Latest master: 9cded63)

@IvanJosipovic
Copy link
Contributor

IvanJosipovic commented Mar 7, 2024

Hey,

I agree that this is a bug, as a workaround you can create a custom DocumentDock and override IsEmpty and set it to false.

using Avalonia;
using Dock.Model.Mvvm.Controls;

namespace App.ViewModels;

public class CustomDocumentDock : DocumentDock
{
    // Fixes bug where the view disappears when empty
    public new bool IsEmpty => false;
}

@BAndysc
Copy link
Contributor Author

BAndysc commented Mar 8, 2024

That's why I love open source :) I couldn't find the root cause before, but after you posted your workaround, it become obvious that something is wrong with updating IsEmpty attached property. And I was able to make a fix: #322

@BradBergstrom
Copy link

Cool! I was just coming here to ask this exact question!

@TobiArndt
Copy link

TobiArndt commented Mar 10, 2024

Your solution is working nicely!
But I have got another question, which seems kinda buggy in the case, when all documents have been closed.
What I really would like is that an empty FilesDocumentDock is not vanishing, when it has no children anymore, but that there is an option that it is staying there, just without any elements.

@BAndysc
Copy link
Contributor Author

BAndysc commented Mar 10, 2024

@TobiArndt You are right, there was IsCollapsable property, but it wasn't respected. Changed the PR to take that into account and now the document dock shall not disappear provided you set IsCollapsable to false

Screen.Recording.2024-03-10.at.16.54.34.mov

@TobiArndt
Copy link

TobiArndt commented Mar 10, 2024

I wanted to start to fix this problem and started reading the code and getting all its logic, and you just did it. Was reading your changes in your pr. Quiet amazing and skillfull! Works like a charme!

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

Successfully merging a pull request may close this issue.

4 participants