Reputation: 14684
hi i have a question about the silverlight/xna template for wp7 programming.
i start a new projekt and then draw some content in the game screen. and then i add the following to the xaml page of GamePage:
<Grid Height="800" Name="grid1" Width="480" Background="White">
<TextBlock Height="30" HorizontalAlignment="Left" Margin="12,12,0,0" Name="textBlock1" Text="Lifes: 3" VerticalAlignment="Top" Foreground="Black" />
<TextBlock Height="30" HorizontalAlignment="Left" Margin="393,12,0,0" Name="textBlock2" Text="Points: 0" VerticalAlignment="Top" Foreground="Black" />
</Grid>
but the problem is i dont see the textBlock and i dont know why. who can give me a hint?
Upvotes: 1
Views: 466
Reputation: 10509
TIP: There was a typo in initial question text. @gurehbgui asked why he isn't seeing the textBox (when he meant TextBlock). That is the reason why this answer is here. After the typo has been fixed this answer became no longer relevant.
You are using a TextBlock
control.
You should use TextBox
to have an edit field for a text element.
Also, since the Foreground is set to Black, a control may not be visible on a black background. You can use Silverlight Spy application to inspect the WP7 GUI layout and debug such problems. Spy supports trial period.
Upvotes: 0
Reputation: 14432
Does your code look anything like this?
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<Grid Height="800" Name="grid1" Grid.Row="1" Width="480" Background="White">
<TextBlock Height="30" HorizontalAlignment="Left" Margin="12,12,0,0" Name="textBlock1" Text="Lifes: 3" VerticalAlignment="Top" Foreground="Black" />
<TextBlock Height="30" HorizontalAlignment="Left" Margin="367,12,0,0" Name="textBlock2" Text="Points: 0" VerticalAlignment="Top" Foreground="Black" />
</Grid>
</Grid>
Because I tested this and it works fine. Here's the result:
Update:
Otherwise you should provide some other code which might cause the problem.
Upvotes: 1