locked
Prevent side by side textblock from overlapping

    Question

  • I am trying to develop a windows store app and I am having an issue. Keep in mind that I am a newbie.

    In the header part, I am trying to have my title on the left and a small text on the right (on the same line). I placed a two column grid and placed a textblock in each column. The result here is that the two textblock overlaps, which is not what I want. Here is the code:

    <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="600*" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <TextBlock Text="{StaticResource AppName}" Style="{StaticResource txtHeaders}" />
                <TextBlock Text="Text on the right" Style="{StaticResource txtHeaders}" />
    </Grid>

    Can anyone help me out?

    Also, the style txtHeaders define only the text color, nothing more.

    Monday, November 19, 2012 4:03 AM

Answers

  • Just for the record, the second textblock is being placed in the same column as the first one. To shift it to the second one, use grid.column = "1". Therefore, the second textblock will be as follows:

    <TextBlock Text="Text on the right" Grid.Column="1" Style="{StaticResource txtHeaders}" />
    • Marked as answer by Yash08 Monday, November 19, 2012 9:13 PM
    Monday, November 19, 2012 9:13 PM