-
Notifications
You must be signed in to change notification settings - Fork 710
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
Unable to set Window Title in XAML #3689
Comments
@ocalvo FYI, who was it that finished up the title bar work in winui3? |
⚠ Still a bug in Preview 4. @StephenLPeters |
Still broken in WinUI 3 production, Project Reunion 0.5.7. |
Still Broken. |
still not fixed |
Still not fix in Reunion 0.8 |
Still broken in 1.0-experimental1. @marb2000 We're not going to ship 1.0 with the inability to set the window title right? RIGHT? 😂 |
There is an (ugly) workaround though. In your Window sub class add this: /// <summary>
/// Gets or sets the window title.
/// </summary>
public new string Title
{
get => base.Title;
set => base.Title = value;
} I had to apply that workaround to WinUIEx well: https://github.com/dotMorten/WinUIEx/blob/86c86233512565873ffc413342dd88ed04dbca14/src/WinUIEx/WindowEx.cs#L81-L88 However I'm worried that the lack of window management APIs and I'm worried people will take one look at WinUI and see that basic window management APIs are more or less non-existent (or as shown above overly complicated to use), and write off WinUI before it even had a chance. |
@dotMorten 🤠 It's pretty ridiculous that this still blows up XAML with an obscure error. But agreed. 👍 |
I had started writing WinUIEx as a temporary stop-gap to the lack of Windowing APIs, but hadn't bothered completely finishing it up or publishing a nuget, because I naturally assumed basic Windowing APIs would be in 1.0, and I was also reluctant because the entire implementation just feels like one giant band-aid. It seems like I need to do bring this all the way to at least close some of these obvious gaps for 1.0. |
Still... present in Preview 1. They got less than two months to fix this. |
Don't think this is getting fixed any time soon, now that there's a workaround. 😞 |
It's still broken. I'm currently using the constructor method for temporary fix. |
Unfortunately, per the latest engineering plan, the bug fix won't make the v1.0 Stable release (GA) and was moved to v1.1 |
This is ridiculous as a so basic function doesn't work on the official version 1.0. |
Yep, just decided to try UWP and WinUI but this thing is just horrible to work with. Back to good ole win32 it is |
Not sure if directly related but when using MAUI blazor app template targeting Windows, title doesnt seem to work either from setting in xaml or ctor of mainpage. |
Similar to what olabacker found, when using a .NET MAUI App template targeted on Windows the title won't appear when defined either in MainPage.xaml or in MainPage.xaml.cs. |
The bug which could not die. Maybe in 1.1? |
Are you serious? You can't even set title in WinUI3 app? EDIT: I have set it programatically in App.xaml.cpp and it worked. Seems like an XAML only issue. window = make<MainWindow>();
window.Title(L"My title");
window.Activate(); |
Yeah I'm just saying that it's probably gonna take a while to get it fixed. I'm using |
Maybe it's worth mentioning that the workaround for C++ looks like this: MainWindow::MainWindow()
{
InitializeComponent();
this->Title(L"Your Window Title");
} |
Still not working without workaround... |
I think we have been making a XAML Title assumption for WinUI based on WPF experience. Code samples here imply that Title in XAML is not intended, and by leaving it out of XAML, we are led to discover the Title Bar capabilities: I.e.: I think that we have a "Works as intended" status here. |
I think it’s a reasonable assumption. What I think went wrong here is the window is a non-WinUI window without the WinUI stuff in it (like inheriting from Dependency Object, understand styling etc). WinUI should make its own Window type that wraps the underlying Windows App SDK window and provide a proper developer experience that’s expected in 2022. I don’t buy the argument that it is as designed and existing expectations aren’t valid - if you want people to move over you need to provide an experience at least on par. The entire Window class is a mess to work with and needs something designed properly for the xaml developer. |
You may be right. I think the TitleBar capabilities may only apply to Windows 11. I'm working with WinUI 3 now, so if I gain any further useful insight, I'll try to keep in mind to share it here. |
WinUI is the future of Windows desktop development. And this is STILL broken. |
Agreed, this is only a small annoyance, but such a simple feature to be reported and still broken after almost two years is scary. Makes one think about Microsoft commitment to WinUI3. So far I haven't hit a roadblock. Yes many minor bugs, a workaround here and there, but nothing remarkable. But it looms large the possibility of finding a major bug in the future that Microsoft won't address. |
The ability to set the Title was added in WinAppSDK 1.3, but there was an issue with it. That issue has been fixed in 1.3.1 that is now available. |
@bpulliam Don't you mean |
Well played :) |
|
@riverar 1.3.1 = 1.3.230502000 (built May 2, 2023), not preview1 (1.3.230228005-preview1 built Feb 28, 2023). Its about 2 months newer :). |
The docs have been updated (https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/stable-channel#version-131-13230502000). Thanks for the heads-up |
How is one supposed to teach developers to use WinUI 3 when the first steps with application requires searching for weird C++ code hacks? Window sizes were solved in .NET Framework 1.0 |
They say there: "Fixed issue causing apps to crash when setting the Window Title in XAML, a new capability added in 1.3.0. For more information, see GitHub issue #3689." |
But setting |
WindowsAppSDK 1.5.3, unpackaged c#/c++ This doesn't work when setting DisableXbfGeneration=true or using XamlReader::Load(). MainWindow.xaml <?xml version="1.0" encoding="utf-8"?>
<Window
x:Class="App1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="hello">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
</StackPanel>
</Window> error
Program fails at
|
At this line
When DisableXbfGeneration=false, type of args.m_value is valueString. |
Describe the bug
In WinUI3preview3, unable to build a project if set the Window Title in XAML.
Steps to reproduce the bug
Blank App, Packaged (WinUI in Desktop)
MainWindow.xaml
to add the following on line 8MainWindow.xaml(8,5): XamlCompiler error WMC0612: The XAML Binary Format (XBF) generator reported syntax error '0x09C4' : Property Not Found
Expected behavior
It should be possible to set the Window Title in XAML.
Screenshots
Version Info
NuGet package version: Microsoft.WinUI 3.0.0-preview3.201113.0
Windows app type:
Additional context
The text was updated successfully, but these errors were encountered: