为什么文本渲染在“默认文本”之间有所不同。和“用户键入文本”在UWP TextBox控件中?
您可以看到第二个文本框(用户键入文本)文本比第一个文本框文本宽。
我在Winui 3中找到了这一点,但在UWP中获得了相同的结果。我无法在WPF中复制它。
这是XAML。
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Row="0"
Grid.Column="0"
Text="Default text" />
<TextBox
Grid.Row="0"
Grid.Column="1"
Text="TestTestTestTestTestTestTestTestTestTest" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Text="Typed text" />
<TextBox Grid.Row="1" Grid.Column="1" />
</Grid>
我的问题在标题中,但我想知道是否有一种使它们相同的方法。
更新
谢谢@niko Zhu!我尝试了您的建议,正如您提到的,这似乎是 ime ?或 Google日语输入问题。
You can see that the 2nd TextBox (user typed text) text is wider than the 1st TextBox text.
I found this in WinUI 3 but got the same result in UWP. I couldn't reproduce this in WPF.
This is the XAML.
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Row="0"
Grid.Column="0"
Text="Default text" />
<TextBox
Grid.Row="0"
Grid.Column="1"
Text="TestTestTestTestTestTestTestTestTestTest" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Text="Typed text" />
<TextBox Grid.Row="1" Grid.Column="1" />
</Grid>
My question is in the title but I'd like to know if there is a way to make them identically.
UPDATE
Thanks @Niko Zhu ! I tried your suggestion and as you mentioned, this seems to be an IME? or Google Japanese Input problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以通过Chinses键盘输入来重现此问题,它看起来 ime 大写字符大于默认值。请使用我们键盘替换,它将解决问题。
I could reproduce this problem with chinses keyboard input, and it looks IME problem that uppercase characters are larger than the default. Please use US keyboard to replace, it will solve the problem.