tags:

views:

68

answers:

1

I have a text box like this

<TextBox x:Name="SA1" Grid.Row="1" Grid.Column="1" TextAlignment="Center"/>

I need a single/two digit number to be placed in the Top-Left corner of this textbox in a lowered font-size. And rest of the text must be styled in a bigger font-size at the center of the Textbox(both vert and hor).

How can I programmatically do this in C#. Similar to what we see in crossword puzzles.

+1  A: 

Since you already have the TextBox in a Grid, you can just add a TextBlock to the same cell that will render on top of it. You can align the TextBlock using HorizontalAlignment and VerticalAlignment, and you can set the font size on it separately.

<TextBox x:Name="SA1" Grid.Row="1" Grid.Column="1"
    TextAlignment="Center" VerticalAlignment="Center" FontSize="20"/>
<TextBlock Grid.Row="1" Grid.Column="1"
    HorizontalAlignment="Left" VerticalAlignment="Top" Text="10" FontSize="8"/>
Quartermeister