I have faced up with the following problem: I cannot vertically align content inside TextBox. I have image icon and TextBox for user input beside, but text in TextBox has default top Alignment. I can change it by setting the VerticalAlignment="Center"
, but then the height of the TextBox becomes less than I need (it should has 43px height). I have tried VerticalContentAlignment="Center
, but it does not work either. I know only one possible solution: set padding
inside TextBox, but I don't like that idea. Maybe there other solutions which I do not know?
Thanks in advance!
Here is part of my code:
<Grid Margin="15,0,15,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image Grid.Column="0"
Source="/Assets/TextInputIcons/Money.png"
Style="{StaticResource InputFieldIconsStyle}" />
<TextBox Grid.Column="1"
PlaceholderText="Sum"
Style="{StaticResource NumberedTextBox}" />
</Grid>
And sample image: