Skip to content

TitleBar API feedback #9700

Closed
Closed
@dotMorten

Description

@dotMorten

Summary

I'm looking at the new TitleBar, and while functionally and visually I LOVE it, I have some concerns about the API itself.

image

First of all, the naming of Header and Footer is very misleading. Those names typically refer to top/bottom items, and the entire control in-of-itself is a header control. I looked at those properties and couldn't at all guess what they really were for, until I saw this image:
image
Generally I'd prefer naming that allows you do an informed guess what they do, and in the community call several people were confused about this.

So these are left/right, and I'm not actually sure if Header is before or after those buttons (illustration doesn't make that clear). Header also clashes with the Title here, adding extra confusion.

My second (albeit slightly lesser) concern is the use of Pane and Back buttons. It's extremely opinionated, and I worry we're gonna get too many apps looking too identical. I'd rather this was a Button collection of sorts instead, where I could choose to add some buttons, or choose to just put them in the "Headers" content (pending a better name). If I needed a 3rd button there I'm out of luck.

Then there's the TitlebarTemplateSettings class:
image

I find this a bit weird. When I think template, I think control templates, but this appears to just be a way to set the app icon - why not just set the icon on the TitleBar directly? But more importantly I think that this should be a Window property (not AppWindow, but Window Window!) that also applies if I don't use the TitleBar.

Another approach is perhaps providing a MUCH simpler titlebar control that just takes care of allowing you to interact with buttons and textboxes etc, while still being able to drag the rest, but you own the entire content as a single content item. Then you add a secondary subclass of that titlebar that adds this more opionated version to cover some common scenarios.

Activity

lolametro

lolametro commented on Jun 5, 2024

@lolametro

They probably wanted to avoid Left/Right due to RTL languages. Usually it would then be called Begin and End.

riverar

riverar commented on Jun 5, 2024

@riverar
Contributor

Agree with the commentary above. To add:

Header and Footer are very confusing. One proposal is to align with Microsoft Fluent components, which use [Content]Before and [Content]After (https://react.fluentui.dev/?path=/docs/components-input--default#content-before-after). This terminology is also suitable for right-to-left languages.

It's also confusing this isn't just part of Window, so that things like setting the icon are naturally wired up to WM_SETICON.

dotMorten

dotMorten commented on Jun 5, 2024

@dotMorten
ContributorAuthor

Yeah being able to write

<Window>
    <Window.TitleBar>
         <TitleBar />
    </Window.TitleBar>
</Window>

would have been way more intuitive, but unfortunately the baseclass of Window is wrong and prevents this.

MikeHillberg

MikeHillberg commented on Jun 5, 2024

@MikeHillberg
Contributor

That property element syntax is OK on Window; that's a general Xaml language syntax and not specific to DO. E.g. you can do

<Window>
    <Window.Title>
        My Window Title
    </Window.Title>
</Window>
dotMorten

dotMorten commented on Jun 5, 2024

@dotMorten
ContributorAuthor

@MikeHillberg Yes but now you can't evaluate binding context. The thing falls apart a soon as you want to bind etc:

<Window>
    <Window.TitleBar>
         <TitleBar Subtitle="{Binding CurrentOpenFile}" />
    </Window.TitleBar>
</Window>

Not to mention your example above didn't even work until very recently and had to be set in code-behind ;D

mdtauk

mdtauk commented on Jun 5, 2024

@mdtauk
Contributor

What would be the best practice to use this TitleBar control, along with a TabView control, where the tabs are not a drag region, but the bar where the tabs are contained, is draggable?

Titlebar's Tall mode would fit well with the TabView, but can you collapse the Header, Icon, Title, Subtitle parts, so content takes up more space?

moshegutman

moshegutman commented on Jun 5, 2024

@moshegutman

Leading/Trailing instead of Header/Footer would work for RTL too.

That's what Apple does: https://developer.apple.com/documentation/swiftui/toolbaritemplacement/topbarleading

BreeceW

BreeceW commented on Jun 5, 2024

@BreeceW
Contributor

My second concern is the use of Pane and Back buttons. It's extremely opinionated, and I worry we're gonna get too many apps looking too identical. I'd rather this was a Button collection of sorts instead, where I could choose to add some buttons, or choose to just put them in the "Headers" content (pending a better name). If I needed a 3rd button there I'm out of luck.

I agree that the pane button is too opinionated and having a button collection instead would be good, but the back button makes sense as a dedicated option. Uniformity there is good and provides a direct alternative to the old CoreWindow back button from UWP. The back button also has a different style that makes sense only for the back button (goes all the way to the edges, like caption buttons), so it’s good that it’s distinct.

roxk

roxk commented on Jun 6, 2024

@roxk

It's extremely opinionated, and I worry we're gonna get too many apps looking too identical.

It being opinionated is a good thing. Windows has been blamed for its inconsistency for a long time and enforcing some kind of consistency is good here. Devs who wish to have custom button collections could always implement their own. I find it wise to leave the official default to represent "what we want devs to do". That's the point of the title bar control - to make apps look the same according to the fluent guideline.

(In fact, you can argue navigation view etc also suffer from this "all apps look the same" problem, but again this is a good thing to have uniformity/consistency. The biggest benefit of consistency is users familiarity)

AndrewKeepCoding

AndrewKeepCoding commented on Jun 6, 2024

@AndrewKeepCoding
Contributor

First of all, the naming of Header and Footer is very misleading.

At least, it's consistent with the NavigationView's TopPane.
image

dotMorten

dotMorten commented on Jun 6, 2024

@dotMorten
ContributorAuthor

At least, it's consistent with the NavigationView's TopPane.

I'd argue that's just as confusing. I can see the consistency argument to some extent, but we could also break with it before it becomes a pattern.

AndrewKeepCoding

AndrewKeepCoding commented on Jun 6, 2024

@AndrewKeepCoding
Contributor

I'd argue that's just as confusing. I can see the consistency argument to some extent, but we could also break with it before it becomes a pattern.

I see. It's still in experimental preview. Everything is possible. Then I hope it gets simpler as you suggest in your comment above.

dotMorten

dotMorten commented on Jun 6, 2024

@dotMorten
ContributorAuthor

It's still in experimental preview. Everything is possible

Yeah hopefully the design isn't settled yet. I assume the experimental previews are here for not just bug testing, but also so we have a chance to give feedback on the overall features, hence this issue.

35 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-TitleBarIssues related to custom window title bars.closed-FixedDescribed behavior has been fixed.needs-triageIssue needs to be triaged by the area ownersteam-ControlsIssue for the Controls team

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      TitleBar API feedback · Issue #9700 · microsoft/microsoft-ui-xaml