Giter Site home page Giter Site logo

np.avalonia.unidock's People

Contributors

npolyak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

np.avalonia.unidock's Issues

How to reopen DockItem?

<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#?

Dock Tab Behaviors

Hey Nick, ... wondering if you have thoughts on how I can get access to tab selection event.

What I need is the following:

  • when docking framework (rehydrates) to know which tab items are (active/inactive - if any) - I suspect I can query XML directly for this (but a way to walk the DockManager tree would be great as well - or any other way you can think of ...)
  • callback when user clicked on Tab (to activate) and which tab is going inactive

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.

Dark Theme

Hey, I wondered if there is dark theme for this project. I checked the codeproject article and there wasn't any information about theming.

Possible to cover up views by dragging them over each other

Hi Nick,

Not sure if this is by design or not but it's possible to inadvertently cover up views and hide them:

  1. Have several views docked toward the right side of the screen.
  2. Dock one of the views all the way to the right. Don't use the per-view dock compass but rather the right-most one that is vertically in the middle (see screenshot)
  3. Now resize this view toward the left as far as it will go. It will cover up any views in its way which seems dangerous as it can make a user think they have fewer views open than they actually do. This doesn't happen when resizing a view that was docked using the per-view docking compass.
    Bug3

Panel gets min width when docked after a separator has been moved

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?

  1. Dock two panels side by side so the separator is vertical
  2. Move the separator any amount, even a few pixels is enough
  3. Now dock a third panel between the two existing ones

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!!

StackDockGroup Background have no effect

1
2
3
4

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>

Unable to use with Avalonia preview version (11.x)

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

Unable to resolve type DockAttachedProperties

Steps to reproduce:

  1. Create a new project using "Avaolonia MVVM Appilcation" template.
  2. Add package reference <PackageReference Include="NP.Avalonia.UniDock" Version="1.0.48" />
  3. In MainWindow.axaml, add the namespace xmlns:np="https://np.com/visuals"
  4. Add attached property to the window as well np:DockAttachedProperties.DockChildWindowOwner="{Binding RelativeSource={RelativeSource Mode=Self}}"
  5. Build.
  6. Build successful, but there is an error, telling "Unable to resolve type DockAttachedProperties"

Unable to (de)serialize to/from a stream

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!

Allow dock items above dock item with "GroupOnlyById" to attach to the root

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.

image

But if I want to attach this floating window to the bottom, the button disapears because the bottom Tabbed Group has GroupOnlyById.

image

I suggest to always allow to attach to the root like this

image

For that I suugest to replace existing code at NP.Avalonia.UniDock.DockManager:

private void OnPointerMoved(Point2D pointerScreenLocation)
{
if (_currentDockGroups == null)
{
return;
}
var pointerAboveGroups =
_currentDockGroups
.Where(gr => gr.Group.IsVisible && gr.Rect.ContainsPoint(pointerScreenLocation))
.Select(gr => gr.Group);
CurrentLeafObjToInsertWithRespectTo = pointerAboveGroups.FirstOrDefault();
var rootDockGroup = CurrentLeafObjToInsertWithRespectTo?.GetDockGroupRoot() as RootDockGroup;
if ((CurrentLeafObjToInsertWithRespectTo != null) &&
(CurrentLeafObjToInsertWithRespectTo is not RootDockGroup) &&
rootDockGroup?.GroupOnlyById == DraggedWindow?.GroupOnlyById)
{
CurrentRootDockGroup = rootDockGroup;
}
else
{
CurrentRootDockGroup = null;
}
}

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;
}

Can not quit App after change layout

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.
1
2

Last version Avalonia

Hi. Thank you for your project. Does it good work for the latest version Avalonia? I can't start it, no work =(

Upgrading to latest 1.0.22 from previous 0.90.0 build issues

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

Screen Shot 2022-01-12 at 6 49 22 PM

kerrigan.
Screen Shot 2022-01-12 at 6 47 59 PM

Doesn't work on Linux

Hello, Nick! Your framework is extremely great, thank you for that! But I have a problem on Astra Linux (Debian-based OS) even in your example.

UniDock

I have the same problem in my application . Have you got any ideas how to fix it?

DataContext on user control causes new instance everytime

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:

  • use your NP.Demos.CustomViewModelsDemo as above
  • create a new usercontrol
  • add the usercontrol into your mainwindow.axaml - replace StockDataTemplate with below xaml

...
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.

How to use binding?

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

Docking compass is squished for small views

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?

More control over DockItem closing

I'm attempting to implement two features in my program:

  1. An "Are you sure you want to close?" dialog when the user tries to close a tab with unsaved changes
  2. A project settings menu that's toggleable by a checkbox

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.

View width jumps to min width when docked vertically

Hi Nick, thank you for the last fix! We are seeing a related issue unfortunately. To reproduce:

  1. Dock 4-5 views horizontally next to each other.
  2. Make sure they don't all have the same width
  3. Drag one of the views and dock it under another one so they are stacked vertically on top of each other.
  4. The group of two views stacked vertically will suddenly have minimum width.

The same thing happens in the opposite case where you stack two views horizontally in a set of vertically stacked views.

Layout Serialization is causing problems due to regional formatting

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:

Before saving
image

After saving
image

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

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.