Comments (7)
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.
And also, have you implemented your own IInterTabClient or IManualInterTabClient?
from dragablz.
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.
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:
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.
Sorry for slowness on this. Hopefully got something coming in the next few days to help with this scenario.
from dragablz.
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.
Layout split API is now in place, closing issue.
from dragablz.
Related Issues (20)
- TabablzControl crashes when no tab items are present
- close button can't show HOT 1
- Dockablz layout does not show Dropzones when inside NavigationView
- Need to update SecondaryAccentBrush to SecondaryHueMidBrush
- Tabablz Item Template unable to set Tab title. Just shows as path to item template source HOT 1
- [Question] drag and drop between two or more lists HOT 2
- Documentation of classes
- MoveWindowWithSolitaryTabs issue
- TabablzControl SelectedIndex binding catches all exception from bound property
- Button in TabItem header
- is there a way to make dragablztabcontrol NOT TEARABLE?
- Layout: Cannot change FloatingItem Content
- How we can do this? : Open forms in different threads and then move the mainwindow all other forms must be move with them in wpf.
- MDI: New added floating item will not show at the front.
- .Net 7 Issue
- Throws System.Reflection.TargetInvocationException while dragging a tab when the tabs are created using ItemsSource.
- handling Default close button HOT 1
- Equal width for all tabs
- Brush renames on MaterialDesignInXAML 5.0.0 HOT 1
- Disposing closed tab
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dragablz.