Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Title bar still not behaving correctly... #7123

Closed
Tracked by #13023
mobycorp opened this issue May 13, 2022 · 15 comments · Fixed by #14517
Closed
Tracked by #13023

Title bar still not behaving correctly... #7123

mobycorp opened this issue May 13, 2022 · 15 comments · Fixed by #14517
Labels
area-controls-window Window fixed-in-8.0.0-preview.4.8333 Look for this fix in 8.0.0-preview.4.8333! p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with partner/winui WinUI / Project Reunion platform/windows 🪟 t/bug Something isn't working t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)

Comments

@mobycorp
Copy link

mobycorp commented May 13, 2022

Description

I just updated my Visual Studio installation to Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.3.0 Preview 1.0 hoping that the <Entry IsPassword="True" /> issue would be fixed (the cursor always skips to position 1 and screws the input completely up) - which it is not (I saw where it was fixed but it did not make it into this release but would come out in the GA release... I really hope someone rethinks that decision and can release it during the next RC release....

But, that's not what I am reporting here. When I fired up my app and I have the OnWindowCreated lifecycle event ExtendsContentIntoTitleBar = true I am expecting the window's chrome title bar background to go transparent. I don't want to see the dark strip across the top of the window:

image

Steps to Reproduce

  1. Create a new MAUI app
  2. Configure the lifecycle events as follows:
.ConfigureLifecycleEvents (lifecycle => {
#if WINDOWS
    lifecycle
        .AddWindows (windows => {
            _ = windows.OnWindowCreated ((window) => window.ExtendsContentIntoTitleBar = true);

            Config.ExtendsContentIntoTitleBar = true;
        });
#endif
})
  1. Run the app...

Version with bug

Release Candidate 3 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

net6.0-windows10.0.1904

Did you find any workaround?

I tried to find the content control in the window control tree and can't find it. Even if I could, there should be a better way to style the color than hacking the visual tree.

Relevant log output

No response

VS bug #1786422

@mobycorp mobycorp added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels May 13, 2022
@v-longmin
Copy link

@mobycorp Could you share your project for us? Thanks.

@v-longmin v-longmin added s/triaged Issue has been reviewed s/needs-info Issue needs more info from the author labels May 13, 2022
@ghost
Copy link

ghost commented May 13, 2022

Hi @mobycorp. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@mobycorp
Copy link
Author

I have placed a repository here:

https://github.com/mobycorp/MobyClientTitleBar

When you run the app, just press the Log In button to get past the login screen... I think I scrubbed this good enough. Let me know if it doesn't work for you...

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels May 13, 2022
@mobycorp
Copy link
Author

mobycorp commented May 13, 2022

Even though it is not in a HitTest-able region of the window's titlebar, you can still click the Switch control if you hover over the teeny bit that's exposed at the bottom. Toggle that and you can see how the hamburger menu gets all munged up... When you close the toggle, you can see the hamburger menu is over (under) layed by the Flyout Header title...

@v-longmin v-longmin added s/verified Verified / Reproducible Issue ready for Engineering Triage and removed s/needs-attention Issue has more information and needs another look s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels May 13, 2022
@v-longmin
Copy link

Verified repro on Windows10 with VS 17.3.0 Preview 1.0 [32427.505.main]. Repro project:
MobyClientTitleBar-main.zip

@Eilon Eilon added the legacy-area-desktop Windows / WinUI / Project Reunion & Mac Catalyst / macOS specifics (Menus & other Controls)) label May 13, 2022
@PureWeen
Copy link
Member

@mobycorp I need to research this scenario a bit more

In the meantime you can try removing it via custom templates inside the WinUI XAML

#5811

<maui:MauiWinUIApplication.Resources>
        <DataTemplate x:Key="MauiAppTitleBarContainerTemplate">
            <Grid HorizontalAlignment="Stretch">
                <ContentControl
                    Grid.Column="4"
                    IsTabStop="False"
                    HorizontalContentAlignment="Stretch"
                    VerticalContentAlignment="Stretch"
                    x:Name="AppTitleBarContentControl">
                </ContentControl>
            </Grid>
        </DataTemplate>
    </maui:MauiWinUIApplication.Resources>

And then do something like this in your window created code to clear out where we set that titlebar
image

Toggle that and you can see how the hamburger menu gets all munged up... When you close the toggle, you can see the hamburger menu is over (under) layed by the Flyout Header title...

What's your overall expectation here? Would it basically be for the hamburger to hide when the flyout is open and then show back up when it's closed?

@mobycorp
Copy link
Author

mobycorp commented May 14, 2022 via email

@mobycorp
Copy link
Author

mobycorp commented May 14, 2022 via email

@mobycorp
Copy link
Author

For example:

image

@PureWeen
Copy link
Member

@mobycorp The area you have in yellow isn't going to be Hit Testable because you are no longer calling SetAppTitleBar

The call to SetAppTitleBar sets up the draggable regions so you can drag the window by that region.

@PureWeen
Copy link
Member

@mobycorp you can read more about the custom title bar options here. They also talk about how to set the colors for the caption buttons as well.

https://docs.microsoft.com/en-us/windows/apps/develop/title-bar?tabs=winui3#full-customization

If you set ExtendsContentIntoTitleBar=true without specifying a drag region by calling SetTitleBar with a UIElement the application will create a fallback title bar that only contains the minimum drag region and caption controls.

@mobycorp
Copy link
Author

mobycorp commented Jun 25, 2022

UPDATE: I have found that by using the following style:

<SolidColorBrush
	x:Key="WindowCaptionBackground">Transparent</SolidColorBrush>

The title bar area that appears darker as shown in the screenshot above is now clear. BUT!!! The title bar hit testable region is still only 24 (or 32?) units wide (it needs to be 48 because the MAUI default for the title bar area is 48 units). This means when the shell title bar is shown, the whole title bar area is not hit testable and thus, can't be used to drag the window around on the desktop. This will frustrate users.

I have tried several approaches as laid out in the following WinUI 3 documentation page:

https://docs.microsoft.com/en-us/windows/apps/develop/title-bar?tabs=winui3

This approach does not work because when the MAUI toolbar gets drawn, it is underneath the title bar strip, thus occluding the most of the tool (title) bar, and none of the title bar area is hit testable...

I think what would make this whole thing a lot easier is for you to publish all of the overridable styles there are in the whole Window layout. Those that I can identify are:

WindowCaptionBackground
WindowCaptionBackgroundDisabled

I discovered just by trial and error that

WindowCaptionButtonBackground
WindowCaptionButtonBackgroundDisabled

also work.

In addition to these, in Styles.xaml, there are these properties that can be overridden:

Shell.BackgroundColor
Shell.ForegroundColor
Shell.TitleColor
Shell.DisabledColor
Shell.UnselectedColor
Shell.NavBarHasShadow
Shell.TabBarBackgroundColor
Shell.TabBarForegroundColor
Shell.TabBarTitleColor
Shell.TabBarUnselectedColor

There has to be more than this...

@mobycorp
Copy link
Author

mobycorp commented Jun 25, 2022

And... Here's something I can't replicate because it is so intermittant, sometimes when the app starts, the original title bar is laid out and the title bar can be used to drag the window and the other bits that a title bar is supposed to do and at other times, the title bar is completely missing. I can start and stop the app in succession and sometimes the bar is there and sometimes it is not - and nothing has been changed.....

Here is one activate of the app (notice the yellow highlight above the live preview controls):

Screenshot 2022-06-25 092416

Then, simply restarting the app with no changes, the titlebar area is completely missing...

Screenshot 2022-06-25 092439

@mikeparker104 mikeparker104 added the partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with label Oct 14, 2022
@samhouts samhouts added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Oct 18, 2022
@KCarterSr
Copy link

Hi Shane, I missed your question at the bottom... My expectation is that the page title that is displayed in the title bar would have its margin set in such a way the hamburger menu would not be overlaid. You can still see the hamburger, and it does click, but move the title over x pixels so there is no sharing of real estate in the title bar... I'm still struggling with this suggested approach in that the content control stretches up to the window control buttons (minimize, maximize, and close) and the color behind these buttons is still dark. Also, the content control is not hit testable so I am not able to drag the window by click/hold and move the window by its title bar... I downloaded the Maui source code and found where it seems to be being defined by default in the WindowRootViewStyle.xaml file but nothing jumped out at me as to how the titlebar color is set... Thoughts? Steve

On Fri, May 13, 2022 at 2:00 PM Shane Neuville @.> wrote: @mobycorp https://github.com/mobycorp I need to research this scenario a bit more In the meantime you can try removing it via custom templates inside the WinUI XAML #5811 <#5811> maui:MauiWinUIApplication.Resources </maui:MauiWinUIApplication.Resources> And then do something like this in your window created code to clear out where we set that titlebar [image: image] https://user-images.githubusercontent.com/5375137/168388713-c977a87e-3980-4093-a24f-0c77ae189f09.png Toggle that and you can see how the hamburger menu gets all munged up... When you close the toggle, you can see the hamburger menu is over (under) layed by the Flyout Header title... What's your overall expectation here? Would it basically be for the hamburger to hide when the flyout is open and then show back up when it's closed? — Reply to this email directly, view it on GitHub <#7123 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOPRYYJC5AHS5EVIDPPIOD3VJ27FXANCNFSM5VZ55RKQ . You are receiving this because you were mentioned.Message ID: @.>

You said that you downloaded the Maui source code, I've been looking for that to see about the title bar. Do you have a link to that?

@samhouts samhouts added this to the .NET 8 Planning milestone Jan 26, 2023
@samhouts samhouts added the partner/winui WinUI / Project Reunion label Jan 26, 2023
@samhouts samhouts added blocked Work that is currently blocked external labels Jan 26, 2023
@samhouts samhouts removed s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Apr 5, 2023
@PureWeen
Copy link
Member

@mobycorp Once we merge this the experience should be better. Once that's pushed out with NET8 previews if you can test and let me know!

@samhouts samhouts closed this as completed May 2, 2023
@samhouts samhouts removed blocked Work that is currently blocked external labels May 3, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 2, 2023
@samhouts samhouts added the fixed-in-8.0.0-preview.4.8333 Look for this fix in 8.0.0-preview.4.8333! label Jun 8, 2023
@samhouts samhouts modified the milestones: .NET 8 Planning, .NET 8 Aug 1, 2023
@Eilon Eilon added t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK) area-controls-window Window and removed legacy-area-desktop Windows / WinUI / Project Reunion & Mac Catalyst / macOS specifics (Menus & other Controls)) labels May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-window Window fixed-in-8.0.0-preview.4.8333 Look for this fix in 8.0.0-preview.4.8333! p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with partner/winui WinUI / Project Reunion platform/windows 🪟 t/bug Something isn't working t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants