Skip to content

TitleBar windows - Minimise/ close buttons become invisible with theming #33975

@IeuanWalker

Description

@IeuanWalker

Description

Cant see any properties to control the built in windows buttons, when changing the theme of the app the buttons become invisible -

2026-02-09.22-05-36.mp4

Steps to Reproduce

Set the app.xaml.cs to the following -

public partial class App : Application
{
	Window? _mainWindow;

	public App()
	{
		InitializeComponent();
	}

	protected override Window CreateWindow(IActivationState? activationState)
	{
		_mainWindow = new Window(new MainPage())
		{
			Title = "Cockpit",
			TitleBar = new TitleBar
			{
				BackgroundColor = Color.FromArgb("#181818"),
				ForegroundColor = Color.FromArgb("#CCCCCC"),
				HeightRequest = 48
			}
		};

		return _mainWindow;
	}

	public static void UpdateTitleBarTheme(string theme)
	{
		App? app = Current as App;
		if(app?._mainWindow?.TitleBar is TitleBar titleBar)
		{
			if(theme == "light")
			{
				titleBar.BackgroundColor = Color.FromArgb("#F8F8F8");
				titleBar.ForegroundColor = Color.FromArgb("#3B3B3B");

				// Update button text color
				if(titleBar.TrailingContent is HorizontalStackLayout stack &&
					stack.Children.FirstOrDefault() is Button btn)
				{
					btn.TextColor = Color.FromArgb("#3B3B3B");
				}
			}
			else
			{
				titleBar.BackgroundColor = Color.FromArgb("#181818");
				titleBar.ForegroundColor = Color.FromArgb("#CCCCCC");

				// Update button text color
				if(titleBar.TrailingContent is HorizontalStackLayout stack &&
					stack.Children.FirstOrDefault() is Button btn)
				{
					btn.TextColor = Color.FromArgb("#CCCCCC");
				}
			}
		}
	}
}

Call UpdateTitleBarTheme withing the app somewhere

Link to public reproduction project repository

No response

Version with bug

10.0.30

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions