AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.15k stars 2.18k forks source link

Extend SplitView #14346

Open CodeDevAM opened 7 months ago

CodeDevAM commented 7 months ago

I would like to propose that a SplitView could also expand from top to bottom.

On top of that I would Like to propose that the size of the pane could be given as a proportion of the parent size.

Last but not least it would be great of the User could change the size of the expanded pane with some kind of GridSplitter.

CodeDevAM commented 7 months ago

I would like to provide an example. I would love to see if something comparable would find its way to Avalonia.

https://github.com/AvaloniaUI/Avalonia/assets/125025268/f2f821a7-d846-4b5f-89c9-8414005c3ec6

TopViewExample.zip

maxkatz6 commented 7 months ago

@CodeDevAM it should be possible to improve SplitView, but as you can see, this layout can be implemented relatively easy even without SplitView.

The problem with SplitView is that it can work in overlay mode, on top of main content. And simple Grid + GridSplitter combination won't work well. Instead, there should be a Thumb and manually pointer events handling, adjusting PaneWidth.

CodeDevAM commented 7 months ago

Just for fun:

The overlay feature is realativly easy to add: https://github.com/AvaloniaUI/Avalonia/assets/125025268/82e45a8d-54c9-458c-9a5f-3fc0956e1c0e

TopViewExample.zip

In the end I don't care how it's working under the hud. But having a pane that extends from top to bottom would be nice. It's a very cool feature for some options that you want to hide most of the time and display them only if needed. It could also be an alternative to an Expander.

timunie commented 7 months ago

API wise I suggest these new StyledProperties:

Add new (not required) TemplatePart: PART_OpenPaneResizeThumb (is only visisble if Pane is open && CanUserResizeOpenPane)

CodeDevAM commented 5 months ago

Will this become a modification of SplitView control or would this become a new control?

Maybe this could be considered as a replacement for Expander as well.

How can I support?

timunie commented 5 months ago

it should be improvement to current SplitView, I don't see it breaking current impl.

CodeDevAM commented 5 months ago

I need to say I am not deep into the concepts and the idea how Avalonia is implemented under the hood. But I want to learn. Is there a documentation about this?

I has taken a look into https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Controls/SplitView/SplitView.cs

I did notice that setting the position of the pane basically results in adding a pseudo class to the SplitView. But I don't know where to find the actual template or layout that belongs to these pseudo classes.

timunie commented 5 months ago

I did notice that setting the position of the pane basically results in adding a pseudo class to the SplitView. But I don't know where to find the actual template or layout that belongs to these pseudo classes.

check FluentTheme and SimpleTheme projects for it.

maxkatz6 commented 5 months ago

Note, since SplitView is ported from UWP/WinUI, it's always a good idea to research how they dealt with the same issues.

For example, while GridSplitter is only usable with actual Grids, UWP (specifically Windows Community Toolkit) have added PropertySizer control: https://learn.microsoft.com/en-us/dotnet/communitytoolkit/windows/sizers/propertysizer https://github.com/microsoft/microsoft-ui-xaml/issues/190#issuecomment-1284656279

Which can be used to resize bind width of the split view.

maxkatz6 commented 5 months ago

Also https://github.com/CommunityToolkit/WindowsCommunityToolkit/discussions/4672 In terms of resizing, whole discussion can be shifted from SplitView itself to GridSplitter/PropertySizer.

CodeDevAM commented 5 months ago

Is there a need to keep the implementations similar or in sync?