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

Using dragablz:TabablzControl in dialog cause itemsource to be cleaned out #74

Open
ruslanfedoseenko opened this issue Jan 14, 2016 · 10 comments

Comments

@ruslanfedoseenko
Copy link

I'm using dragablz:TabablzControl in separate dialog with a dialog ViewModel.
I want to reuse dialog ViewModel because recreation of it is expencive.
Also i have ConsolidateOrphanedItems=True.
When closing dialog Collection Binded to ItemSource is Cleared.
After looking the code i found that WindowOnClosing dont take into account witch window is closed owner one or child window when tab is taken away.

@ButchersBoy
Copy link
Owner

Hi, from your description I can't quite understand your situation.

Are you aware of TabablzControl.GetIsClosingAsPartOfDragOperation(Window) and how to implement your own IInterTabClient and TabEmptiedResponse? With a combination of these you should be able to control the tabs behaviour quite granularly.

@ButchersBoy
Copy link
Owner

...you might have to post a sample repo for me to understand your requirement.

@ruslanfedoseenko
Copy link
Author

I posted in gitter call stack of clearing
Dragablz.dll!Dragablz.Core.CollectionTeaser.Remove(object item) Line 63 Dragablz.dll!Dragablz.TabablzControl.RemoveFromSource(object item) Line 606 Dragablz.dll!Dragablz.TabablzControl.WindowOnClosing(object sender, System.ComponentModel.CancelEventArgs cancelEventArgs) Line 828
Here is IInterTabClient

public class TabablzInnerTabClient : IInterTabClient
{
    public INewTabHost<Window> GetNewHost(IInterTabClient interTabClient, object partition, TabablzControl source)
    {
        var window = new MetroWindow();
        var view = new TabablzControlContainer();
        window.Content = view;
        return new NewTabHost<Window>(window, view.TabablzControl);
    }

    public TabEmptiedResponse TabEmptiedHandler(TabablzControl tabControl, Window window)
    {
        return TabEmptiedResponse.CloseWindowOrLayoutBranch;
    }
}

@ButchersBoy
Copy link
Owner

can you post a sample app though?

@ruslanfedoseenko
Copy link
Author

yeap I'll make a repo for you

@ButchersBoy
Copy link
Owner

cool, when you post it post step by step instructions so i know exactly what you are doing

@ruslanfedoseenko
Copy link
Author

Here it is
https://github.com/ruslanfedoseenko/TabablzControlBug

To reproduce bug:
1 launch application
2 press Show Dialog
3 Close Dialog
4 press Show Dialog again
After closing dialog all items of dialog TabablzControl will be moved to MainWindow TabablzControl

Probably it is not a bug. I should use Partiotion property, am I right?

@ButchersBoy
Copy link
Owner

Before I look at your repo; Partition property allows different "groups" of tabs...so let me know if that fixes your problem.

@ruslanfedoseenko
Copy link
Author

No it dont fix my issue.
Also it is not bindable now so it is a problem for me. Because UI in my application is dynmic and based on ViewModel resolving with help of DataTemplates.

@ButchersBoy
Copy link
Owner

No, it's not bindable; it can't be. The framework needs to know the partition up-front.. Be the parent controller is, so you can get around most things that way.

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