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.25k stars 2.19k forks source link

Provide a way to get the Min / Max / Close- Button positions #7460

Open timunie opened 2 years ago

timunie commented 2 years ago

Is your feature request related to a problem? Please describe. I like the idea to render extend into the title bar and keep the system chrome alive with the Min/ Max/ Close buttons. Then I would like to place content like Tabs into the TitleBar. the issue I have is, that I cannot now how much space I have to reserve for the system window Buttons or on which side they are (I think on Mac they are on a different side then for Windows)

Describe the solution you'd like A property on the Window which tells me where some reserved space is, for example:

ReservedSpace[] ReservedSpaces = new ReservedSpace[] 
{ 
     new ReservedSpace (width: 75, height: 20, Position: Position.TopRight)
};

Describe alternatives you've considered

Additional context See also: https://docs.avaloniaui.net/tutorials/music-store-app/creating-a-modern-looking-window

/cc @danwalmsley @ahopper this is a follow-up issue from our discussion on telegram.

Happy coding Tim

maxkatz6 commented 2 years ago

Couple of thoughts:

  1. There should be an event, so application can adjust elements dynamically (on macos these buttons are hidden in fullscreen, and visible again in normal mode...). See https://stackoverflow.com/a/52803798
  2. Same API potentially can be used for reserved parts on mobile screens, including iphone notch
  3. It should use native APIs instead of some hardcoded "well known" values.
  4. I guess this API won't be possible on Linux with some desktop implementations
Symbai commented 2 years ago

On several WPF third party themes the customizable window header area is only from left to the first start of (min or max or close) button so you cannot draw anything on top of these controls. This seems to be much better than adding a new property which only returns the size and the developer has to calculate the distance himself .

timunie commented 2 years ago

@Symbai can you reference any of the mentioned libs? The one I know is MahApps. But they have their own set of Buttons and are not the native ones.

I think there is no out of the box solution here.

Happy coding Tim

Symbai commented 2 years ago

https://github.com/HandyOrg/HandyControl would be one of it

timunie commented 2 years ago

https://github.com/HandyOrg/HandyControl would be one of it

This is really a great example. It nevertheless seems to be not that easy to provide these values for all possible current and future OS versions out there. At least it's beyond my knowledge horizon 😉

Happy coding Tim

maxkatz6 commented 2 years ago

I would say both API can coexist. Low-level reserved space API and high-level titlebar content API.