microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

TextBox PlaceholderText is no longer centered correctly in v1.6.0

Open Balkoth opened this issue 1 year ago • 2 comments

Describe the bug

In WindowsAppSDK 1.5 <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240802000" /> it looks correct like this: image

In v1.6 <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240829007" /> it suddenly looks like this: image

So whatever has changed it messes with the positioning of the PlaceholderText.

Steps to reproduce the bug

<Window
  x:Class="TextBoxTest.MainWindow"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:local="using:TextBoxTest"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  mc:Ignorable="d">

  <StackPanel
    HorizontalAlignment="Center"
    VerticalAlignment="Center"
    Orientation="Horizontal">
    <TextBox PlaceholderText="Search..." />
    <Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
  </StackPanel>
</Window>

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.6.0: 1.6.240829007

Windows version

Windows 10 (21H2): Build 19044

Additional context

No response

Balkoth avatar Sep 26 '24 11:09 Balkoth

Not fixed.

Balkoth avatar Oct 10 '24 13:10 Balkoth

Does anyone even care? This breaks the whole styling and makes the app look ugly now.

Balkoth avatar Oct 14 '24 06:10 Balkoth

I just got around to updating our application from 1.5.7 to 1.6.1 and immediately noticed the same issue. The CheckBox control also seems to be affected, as it displays the content at the top instead of centering it vertically.

Image

Have you found any workarounds for this issue?

Trix07 avatar Oct 28 '24 14:10 Trix07

Unfortunately not. Are you too on Windows 10?

Balkoth avatar Oct 28 '24 15:10 Balkoth

Yeah, I'm still on Windows 10. I tested it on a Windows 11 machine, and it works fine there, so it seems to be an issue only affecting Windows 10 machines.

Trix07 avatar Oct 28 '24 15:10 Trix07

Thought so...

Balkoth avatar Oct 28 '24 15:10 Balkoth

I'm having the same problem with TextBlocks, also on Windows 10.

Image

I'm currently working around it by changing LineHeight and LineStackingStrategy:

<Style x:Key="xBaseTextBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
    <Setter Property="LineHeight" Value="19.5" />
    <Setter Property="LineStackingStrategy" Value="BlockLineHeight" />
</Style>

It's a hassle though. TextBox, CheckBox etc are harder because the TextBlock is nested. The entire template will need to be duplicated.

You can find the original source in .nuget\packages\microsoft.windowsappsdk\1.6.240923002\lib\uap10.0\Microsoft.UI\Themes\generic.xaml

Temetra avatar Nov 11 '24 23:11 Temetra

I guess we can agree that changing and duplicating whole templates, to fix a bug that 1.6.0 introduced is a no-go.

Balkoth avatar Nov 14 '24 06:11 Balkoth

WindowsAppSDK 1.7.241114004-experimental1 also seems to have the same issue. So it is still not fixed in 1.7.

eaproton avatar Dec 09 '24 17:12 eaproton

Come on, is Microsoft a company or an open source ? If you want we can make PR to help with it, but give us access to it (code and concept). With your secret docs and figma design it is hard to collaborate with.

mklemarczyk avatar Feb 15 '25 22:02 mklemarczyk

Windows 10 is out of support soon, so I expect this issue to be closed as not supported scenario. My fix for CheckBox:

<CheckBox Padding="8,0" VerticalContentAlignment="Center">XXXX</CheckBox>

Korzhukov avatar May 21 '25 08:05 Korzhukov

According to https://learn.microsoft.com/en-us/lifecycle/faq/extended-security-updates Windows 10 will receive ESU at least until 2028 so my take is that this still should be fixed.

Balkoth avatar May 21 '25 08:05 Balkoth

According to https://learn.microsoft.com/en-us/lifecycle/faq/extended-security-updates Windows 10 will receive ESU at least until 2028 so my take is that this still should be fixed.

This isn’t a security issue, so I don’t expect it will ever be addressed.

Considering there are still unresolved bugs from 2018 and 2019 in this repository, this one might as well wait until 2028.

Korzhukov avatar May 21 '25 08:05 Korzhukov

This has nothing todo with being a security issue and with the link i posted. The link only states that Windows 10 is in extended support at least until 2028 and Microsoft can't drop Support for WindowsAppSdk on Windows 10 until it is OOS.

It's sad that Microsoft has left such a bad impression on you.

Balkoth avatar May 23 '25 09:05 Balkoth