aru
aru

Reputation: 778

How to align text to center with custom font-family applied to Textbox in winRT XAML app

I am working on winRT C# app. I have Textbox with custom font-family. Due to custom font-family my text in Textbox is aligned to top of Textbox. I tried to set VerticalContentAlignment to "center" but it still not working.

Upvotes: 0

Views: 950

Answers (1)

Chris W.
Chris W.

Reputation: 23280

I'm not so sure it's because of your font, and more likely expected behavior of the TextBox. I would take a look at the control template for your TextBox and check your Setter's and ContentPresenter to see if there isn't a property set to make it that way. Otherwise I think you can touch it via something like;

<TextBox>
  <TextBox.Resources>
      <Style TargetType="TextBlock">
         <Setter Property="VerticalAlignment" Value="Center"/>
      </Style>
  </TextBox.Resources>
</TextBox>

Upvotes: 1

Related Questions