Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/Core/src/Platform/Windows/WindowRootView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ internal void SetTitleBar(ITitleBar? titlebar, IMauiContext? mauiContext)
if (AppTitleBarContentControl is not null)
{
AppTitleBarContentControl.Content = null;
UpdateAppTitleBarTemplate();
}
return;
}
Expand Down Expand Up @@ -560,6 +561,17 @@ private void SetTitleBarInputElements()
PassthroughTitlebarElements = passthroughElements;
}

void UpdateAppTitleBarTemplate()
{
// Ensure the default Window Title template is reapplied when switching from a TitleBar.
// The ContentTemplateSelector is reset to the default when ContentTemplate is null, restoring proper title display.
if (AppTitleBarContentControl.ContentTemplateSelector is null)
{
AppTitleBarContentControl.ContentTemplateSelector =
(DataTemplateSelector)Application.Current.Resources["MauiAppTitleBarTemplateSelector"];
}
}

static void OnAppTitleBarTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((WindowRootView)d)._appTitleBar = null;
Expand Down
Loading