如何增加文本框控件的大小 XAML

How to increase size for textbox control XAML

我需要在文本框控件中增加 'X' 的大小。

样式 属性 名称是什么?

FontSize 属性 仅更改字体的大小,文本框的设置 width/height 不会更改右侧清除按钮的大小。

首先您需要复制 TextBoxdefault style

然后去找这个元素-

<TextBlock x:Name="GlyphElement"
           AutomationProperties.AccessibilityView="Raw"
           Foreground="{ThemeResource TextControlButtonForeground}"
           FontStyle="Normal"
           FontSize="12"
           FontFamily="{ThemeResource SymbolThemeFontFamily}"
           HorizontalAlignment="Center"
           Text="&#xE10A;"
           VerticalAlignment="Center" />

请注意 FontSize 设置为 12。将其更改为 -

FontSize="{TemplateBinding FontSize}"

现在,GlyphElementFontSize 将与其模板化父项(即 DeleteButton)的 FontSize 同步,其中 FontSize然后与其模板化的父级同步 TextBox.

如果您现在增加 TextBoxFontSize,您会看到文本和 X 都变大了。