Git Product home page Git Product logo

Comments (7)

ButchersBoy avatar ButchersBoy commented on July 3, 2024

Hi Damian...quick question before I answer further, I you looking to persist a "layout" in between process life-times? i.e restore Windows tabs to their layouts from a previous session, or is this just during a single run of your app?

from dragablz.

ButchersBoy avatar ButchersBoy commented on July 3, 2024

And also, have you implemented your own IInterTabClient or IManualInterTabClient?

from dragablz.

Damian-P avatar Damian-P commented on July 3, 2024

Yes I'm looking to persist a layout. Users can create multiple workspaces. Each workspace is made of different views (some are different instances of the same class and other are uniques).
And yes I implemented the IInterTabClient.

from dragablz.

ButchersBoy avatar ButchersBoy commented on July 3, 2024

Restoration of layout is the last piece of the jigsaw. I've had plenty of experience of building a layout system in a line of business app which uses a system which is a kind of pre-cursor to Dragablz. In that system everything was full MVVM, but it means a lot of complicated code needs to be written by the consumer, especially where the docking/nesting/MDI stuff is used. So in Dragablz, moving items around in the ObservableCollection may not be the best way - however, you will be able to hook in to do this:

I prefer to have the controls manage the state, and then you can monitor or query the state. But I am trying to provide hooks for this to suit varying requirements.

My preferred patter is for Dragablz to provide and API so you can query the state. And another API so you can reconstruct the state piece by piece. My recommendation will be for client apps to persist a set of instructions which can be used to restore the layout. This is much more robust than for example providing a large brittle blob for example.

So far we have a Query API which can be seen in the demo apps:

image

Also, on the DragablzItemsControl you can bind in a PositionMonitor, for real time monitoring of the position. In here you could potentially update your ObservableCollection. But:

  • I need to push this up to TabablzControl
  • It is up to you to interpret this as the position can also report on X/Y dimensions, for example to the tool windows/MDI

So, to query the state we are 90% there.

To reconstruct the state is a big outstanding part; I will be starting development on this soon. I will knock up another demo app that shows full state deconstruction/reconstruction and I am working on the API.

To clarify, as for new tabs appearing 2nd, I will see what I can do to give you control over this. It's not quite straight forward as we cannot guarantee that every user will have their source collection matching the order of the tabs.

Glad you are enjoying Dragablz...watch this space for updates on this!

James

from dragablz.

ButchersBoy avatar ButchersBoy commented on July 3, 2024

Sorry for slowness on this. Hopefully got something coming in the next few days to help with this scenario.

from dragablz.

ButchersBoy avatar ButchersBoy commented on July 3, 2024

OK, so, as I said, policy is not to keep the tab headers in sync with the order of the source collection. Been down that road in the past and decided against it. But there are some new helper methods and properties to help you when adding stuff. (For querying existing stuff see my comments above re. the Query API.)

New property:

TabablzControl.AddLocationHint

This will specify where, in relation to the selected item, the item should be added. You can add to the start/end of the tabs, or before/after the currently selected item. This hint will be used if you are using the AddNewItemCommand, ShowDefaultAddButton, or add to your source collection in your view model.

New (static) helper methods:

TabablzControl.AddItem(object item, object nearItem, AddLocationHint addLocationHint)

This will find the window/tab that owns the nearItem object and add to the Items or ItemsSource for that control. If you are using the IManualInterTabClient it will defer to that to allow you to add into your collection manually.

TabablzControl.SelectItem(item)

Finds the item, in any active tab control and selects it. Useful if you've just added a tab and immediately want it selected.

If it helps, this technique is what I prefer and am using in a project I am currently working on.

Still outstanding:

Programmatic splitting of layouts. Once this is done one should be able to reconstitute some kind of persisted layout entirely in code.

from dragablz.

ButchersBoy avatar ButchersBoy commented on July 3, 2024

Layout split API is now in place, closing issue.

from dragablz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.