npolyak / np.avalonia.unidock Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
<np:TabbedDockGroup >
<np:DockItem Header="DockItem1" Name="DockItem1" DockId="DockItem1">
</np:DockItem>
<np:DockItem Header="DockItem2" Name="DockItem2" DockId="DockItem2">
</np:DockItem>
</np:TabbedDockGroup>
in C#:
DockItem1.Select(); Will bring DockItem1 to front.
DockItem2.Select(); Will bring DockItem2 to front.
If I close DockItem2, DockItem2.Select(); Will have no effect. How can I reopen DockItem2 in C#?
in addition:
If I close DockItem2 and DockAttachedProperties.GetTheDockManager(this).SaveToFile(pathString); Then Reopen App, DockAttachedProperties.GetTheDockManager(this).RestoreFromFile(pathString); How can I reopen DockItem2 in C#?
Hey Nick, ... wondering if you have thoughts on how I can get access to tab selection event.
What I need is the following:
The reason for above is because we have very heavy processing, and we want to (disable) processing if tab is not visible (in active)
Now given your nice attached behaviors you have - i believe I can get this callback and attach events on the element - the problem is that the DockItemHeaderControl (is that the element I need to attach to)?? is in styles.xaml - and I hate to copy over that style - in order to add my attachedproperty to it (i.e. if you make an update - it might break my updated style)
anyway, hope what I asked makes sense - maybe you have some additional magic?
thanks
Kerrigan.
Hey, I wondered if there is dark theme for this project. I checked the codeproject article and there wasn't any information about theming.
Hi Nick,
Not sure if this is by design or not but it's possible to inadvertently cover up views and hide them:
Hi Nick!
Been a long time, I used to work with you at ITG. I now work with Kerrigan on a new app that uses your awesome docking framework. One of the issues we're seeing goes like this, could you please take a look into it?
Normally the panels are proportionally sized so they would all have the same width. Once the separator is moved however, any new panel that gets added to the stack will have the min width. I debugged the code (super clean and easy to follow by the way), and the issue seems to be caused by the proportional/star width of the column definitions. By default, the size is 1*. When a splitter is moved though, the col defs will get the actual width, so could be something like [150*, 210*, 300*]. I assume Avalonia changes these from 1*, I don't see your code doing it anywhere. The problem is that when a new panel is added to the stack, it will get the 1* width which is much smaller than the others so it will get the min width. Same thing happens when the separators are horizontal.
I'm not sure what's the best solution here, maybe the initial width could be some kind of average of the col def widths to keep things simple.
Thanks!!
TabbedDockGroup is OK, but StackDockGroup Background have no effect. And StackDockGroup Header height can not change with fontsize.
<Grid Background="Yellow"> <np:RootDockGroup Background="Transparent" FontSize="20" np:DockAttachedProperties.TheDockManager="{StaticResource TheDockManager}"> <np:StackDockGroup TheOrientation="Horizontal" Background="Orange"> <np:StackDockGroup TheOrientation="Vertical" Background="Red"> <np:DockItem Header="StackTop" DockId="StackTop" Background="Transparent"/> <np:DockItem Header="StackBottom" DockId="StackBottom" Background="Transparent"/> </np:StackDockGroup > <np:TabbedDockGroup Background="LightBlue"> <np:DockItem Header="Tabbed1" DockId="Tabbed1" Background="Transparent"/> <np:DockItem Header="Tabbed2" DockId="Tabbed2" Background="Transparent"/> </np:TabbedDockGroup> </np:StackDockGroup > </np:RootDockGroup> </Grid>
Hi, I love to use this excellent library but it currently does not work with the 11.x preview version of Avalonia.
Any plans to update the package to support the 11.x version of Avalonia? I tried to clone the source to see if I can edit the changes to the broken changes like IStyle, but the source is checked out.
Thanks,
db
Steps to reproduce:
<PackageReference Include="NP.Avalonia.UniDock" Version="1.0.48" />
xmlns:np="https://np.com/visuals"
np:DockAttachedProperties.DockChildWindowOwner="{Binding RelativeSource={RelativeSource Mode=Self}}"
Could you add the ability to use a stream for persistence instead of having to use a file? We send the information over the wire so it would be great if we didn't have to deal with temp files and permissions when (de)serializing. Thanks!
Now if you have dock with "GroupOnlyById", other docks that are above this one can't attach even to the root (top, right, bottom and left positions).
For example, "Floating Window - Hi" can attach to the bottom if it's above Dock Item "Hello" which doesn't have GroupOnlyById.
But if I want to attach this floating window to the bottom, the button disapears because the bottom Tabbed Group has GroupOnlyById.
I suggest to always allow to attach to the root like this
For that I suugest to replace existing code at NP.Avalonia.UniDock.DockManager:
NP.Avalonia.UniDock/src/DockManager.cs
Lines 359 to 384 in 70ed1e2
With this code:
private void OnPointerMoved(Point2D pointerScreenLocation)
{
if (_currentDockGroups == null)
{
CurrentLeafObjToInsertWithRespectTo = null;
}
else
{
var pointerAboveGroups =
_currentDockGroups
.Where(gr => gr.Group.IsVisible && gr.Rect.ContainsPoint(pointerScreenLocation))
.OrderBy(gr => gr.Group.GetGroupWindow() != null)
.Select(gr => gr.Group);
CurrentLeafObjToInsertWithRespectTo = pointerAboveGroups.LastOrDefault();
}
RootDockGroup? rootDockGroup = null;
if (CurrentLeafObjToInsertWithRespectTo != null && CurrentLeafObjToInsertWithRespectTo is not RootDockGroup)
{
rootDockGroup = CurrentLeafObjToInsertWithRespectTo?.GetDockGroupRoot() as RootDockGroup;
}
else if (CurrentLeafObjToInsertWithRespectTo == null && _rootGroups != null)
{
var pointerAboveRoots =
_rootGroups
.Where(gr => gr.Group.IsVisible && gr.Rect.ContainsPoint(pointerScreenLocation))
.OrderBy(gr => gr.Group.GetGroupWindow() != null)
.Select(gr => gr.Group);
rootDockGroup = pointerAboveRoots.LastOrDefault();
}
CurrentRootDockGroup = rootDockGroup?.GroupOnlyById == DraggedWindow?.GroupOnlyById ? rootDockGroup : null;
}
I use Visual Studio, Run in debug mode. if i change layout, like drag and drop DockItem, then close the app by click window's “close button” at top right corner, The window disappeared, but App still run in "Task Manager", and Visual Studio do not quit debug mode. if i do not change layout, it will quit successful.
Hi. Thank you for your project. Does it good work for the latest version Avalonia? I can't start it, no work =(
Hi Nick, i recently upgraded to latest unidock (on mac - btw windows works fine and builds correctly) ... when i now try to build ...i get the following build error
/Projects/avalonia/unidock/NP.Avalonia.Demos/NP.Demos.UniDockIntroductionDemo/MainWindow.axaml(6,6): Error XAMLIL: Unable to resolve type SimpleDockGroup from namespace https://np.com/visuals Line 29, position 6. (XAMLIL) (NP.Demos.UniDockIntroductionDemo) Avalonia
(previously version on mac builds fine - 0.90.0)
i'm attaching screen shots if that might help. please let me know if you need any other info...
thanks
Hey Nick, ... using your NP.Demos.CustomViewModelsDemo as an example - in this case what I want to do is inject a user control into DataTemplate ... Works great - however whenever user moves docking tabs/items around a new instance of user control is recreated !!
This is not good - (in my case my user control is a browsercontrol - and it literally reloads and recreates a new chrome renderer process...).
Seems like maybe the itemscontrol or something inside unidock is causing it to recreate?
It's very easy to repo:
...
xmlns:local="clr-namespace:NP.Demos.CustomViewModelsDemo"
Now run the demo - and set a breakpoint on UserControl1 constructor ...
(create a few dockitems ...and try moving them around ...your breakpoint gets hit everytime ...recreating a new instance...)
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this); <-- this called everytime you move around
}
as said above - this plays havoc (when my user control is a browsercontrol - cefglue)
hopefully you have some ideas - else i'm out of luck ... any help appreciated ...
thanks
Kerrigan.
I don't understand how to use binding. I'm trying to do following:
<np:RootDockGroup TheDockManager="{StaticResource TheDockManager}">
<np:StackDockGroup TheOrientation="Vertical">
<np:StackDockGroup TheOrientation="Horizontal">
<np:DockItem Header="{Binding MyText}">
<TextBlock Text="{Binding MyText}"/>
</np:DockItem>
<np:DockItem Header="{Binding MyText}">
<TextBlock Text="{Binding MyText}"/>
</np:DockItem>
But binding doesn't work after dragging tab. Also I'd like to say I can't do smth like this:
<local:TestViewModel x:Key="TheViewModel"/>
in xaml cause of my constructor in viewmodel
It would be great if the compass would always appear the same regardless of the size of the target view. For small views, it gets squished and is not really usable. Would it be possible to always have it look the same, even if it would go outside the bounds of the target view?
I'm attempting to implement two features in my program:
For the former, I need to be able to prevent a DockItem from closing when the user doesn't say "yes" to a dialog box.
For the latter, I need to be able to close the DockItem from code for when the user loads a different/creates a new project.
The closest I got to the first functionality was by registering a Button.ClickEvent
handler and checking if((e.Source as Button).Name == "CloseButton")
, but that method still can't prevent the DockItem from closing.
I didn't make any progress on closing the DockItem from code.
Hi Nick, thank you for the last fix! We are seeing a related issue unfortunately. To reproduce:
The same thing happens in the opposite case where you stack two views horizontally in a set of vertically stacked views.
No bugs, no complains, just great library!
Will there be a version for 11.0.0-preview4?
Hey Nick,
I'm having an issue with the serialization of layouts, and I believe it is related to regional formatting.
My colleague has czech regional formatting, which uses commas (",") for separating decimal numbers, instead of the usual decimal points (".")
After looking at the serialization, it seems like that when saving the layouts, it uses the GridLength.ToString() method to convert it to strings, which is not culture-invariant. See DockGroupParams.ToGroupParams(this IDockGroup dg)
, line 149.
But when loading the layouts, it uses the GridLength.Parse
method, which, when looking at the Avalonia Source code, correctly uses Invariant Culture for parsing.
In some cases this results in commas being ignored when loading a saved layout:
I believe this can be fixed by changing the non-culture-invariant call to GridLength.ToString()
to something like GridLength.Value.ToString(CultureInfo.Invariant)
(of course considering the star etc)
I hope it is clear what I'm explaining :)
Thanks,
Karmoq
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.