Andersen27 / Photino.Blazor.Docking

Docking system for Photino.Blazor applications with split, tabs and floating panels support
MIT License
10 stars 1 forks source link

Adding DockPanels to DockPanelTabs at runtime #2

Open pm64 opened 6 months ago

pm64 commented 6 months ago

The demo project clearly shows how to set up a docking environment based on a previously saved configuration or hardcoded arrangement.

But how would I go about adding tabs to a DockPanelTabs container at runtime?

I tried the following:

<DockPanelTabs>
    @foreach(var dockPanel in _dockPanels)
    {
        <DockPanel Id="@dockPanel.Id" />
    }
</DockPanelTabs>

where

private List<DockPanel> _dockPanels = new List<DockPanel>();

along with a button that fires this:

private void AddTab()
{
    _dockPanels.Add(new DockPanel() { Id = "index" });
}

I expected this to cause a tab to get added to the DockPanelTabs container, but it didn't.

The tab group is rendered as expected when items in _dockPanels are pre-defined..

private List<DockPanel> _dockPanels = new List<DockPanel>() { 
    new DockPanel() { Id = "index" }, 
    new DockPanel() { Id = "index" } 
};

But then adding to the collection still doesn't have any effect. I must be approaching this incorrectly?

Right now, I'm just trying to add a new instance of a tab page to the tab group. But in other scenarios I might want to add a duplicate instance of a tab already in the group, or detect that a tab of that type is already in the group and focus the existing tab instead of adding one.

Andersen27 commented 6 months ago

As far as I can imagine, the idea is to use DockPanelTabs as a document host or a opened files panel (classic IDEs behaviour). My implementation involves the use of panels unified by type, i.e. one instance of the panel in entire docking layout. However, the request is important, I will think about how best to implement this. This may look something like a new object Context property for the DockPanel (or a new component) so that you can set an arbitrary context for the panels. It will be possible to dynamically add/remove such panels

pm64 commented 6 months ago

@Andersen27 that sounds fantastic. I think using a new Context property is the right approach.

Very excited to see where you go with this! Thank you for the thoughtful discussion.

pm64 commented 3 months ago

Hey @Andersen27, just a quick check-in to see if you expect progress on this piece in the near term? No pressure, just trying to organize things on my end. Hope all is well!

Andersen27 commented 3 months ago

@pm64 I have no enought time now, but I plan to use this project in my job during this or next year. So I plan to develop the project, but later. At my job's demo I use RadzenTabs component from Radzen for documents view and this project for docking other panels, which are the singular and has no context. Tabs inside RadzenTabs will not have docking behaviour, but generally the solution looks good. Maybe this option will suit you.

pm64 commented 2 months ago

Hi @Andersen27, thanks for this update. I'm sure I've mentioned this has been my favorite Photino project since the day I came across it.. so I'm super glad to hear further development is planned! Dockable tabs are a requirement for my applications, so RadzenTabs won't quite cut it. But I'll keep an eye on your repos and look forward to what the future holds. You are a gifted engineer and these projects have such amazing potential. Thanks again!