Skip to content

[MAUI] 'Window.Title' couldn't be displayed after setting ‘Window.TitleBar' #27022

@Zhanglirong-Winnie

Description

@Zhanglirong-Winnie

Description

Affected Build: 17.13.0 Preview 3.0 [35708.219.main]
Affected project:
https://microsoft-my.sharepoint.com/:u:/p/v-tianlz/EYHhIT_CE7JPvlYdzCBHjygBrWviXvWZ305RgE_s6eK84Q?e=3rEAtu

Steps to Reproduce

  1. Create .net MAUI project or Run the Sample Project
  2. Add the following code in MainPage.xaml:
    <Button
	     x:Name="CounterBtn2"
	     Text="Click me2" 
	     SemanticProperties.Hint="Counts the number of times you click"
	     Clicked="OnCounterClicked2"
	     HorizontalOptions="Fill" />
  1. Change the two Button events in MainPage.xaml.cs:
        private void OnCounterClicked(object sender, EventArgs e)
	 {
	     this.Window.TitleBar = null;
	     this.Window.Title = "Title";
	 }
	
	 private void OnCounterClicked2(object sender, EventArgs e)
	 {
	    this.Window.TitleBar = new TitleBar()
	    {
	        Title = "[TitleBar.TitleBar]",
	        Subtitle = "[Title.Subtitle]",
	        BackgroundColor = Color.FromRgb(255, 255, 0)
	    };
	 }
  1. Debugging on a Windows machine
  2. Click "Click Me"->Windows title displays "Title";
  3. Click "Click Me2"->Windows title displays "[TitleBar.TitleBar]";
  4. Click "Click Me" again to observe the Windows title display;

Actually:
Windows has no “Title” display.
Image

Expected:
The Windows "Title" displays normally.
Image

Link to public reproduction project repository

https://microsoft-my.sharepoint.com/:u:/p/v-tianlz/EYHhIT_CE7JPvlYdzCBHjygBrWviXvWZ305RgE_s6eK84Q?e=3rEAtu

Version with bug

Microsoft.Maui.Controls 9.0.30-ci.main.25058.3

Is this a regression from previous behavior?

Don't know. Previous versions were blocked by this issue(9.0.22 & 9.0.0).#26396

Affected platforms

Windows

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions