2011-04-04 74 views
1

喜歡在標題:)爲什麼我看不到我的Windows Phone 7應用程序中的按鈕?

我寫的教程:http://msdn.microsoft.com/en-us/wp7trainingcourse_yourfirstwp7applab_topic3 一切都像那裏。 我的代碼:

<!--LayoutRoot is the root grid where all page content is placed--> 
<Grid x:Name="LayoutRoot" Background="Transparent"> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="120"/> <!-- Problem resolved --> 
     <RowDefinition Height="*"/> 
    </Grid.RowDefinitions> 

    <!-- this i can not see any ideas what is wrong? --> 

    <StackPanel Orientation="Vertical" VerticalAlignment="Stretch"> 
     <Button x:Name = "SolveButton" Content="Solve" Margin="10" 
       HorizontalAlignment="Center" Click="SolveButton_Click" /> 
     <StackPanel x:Name="StatusPanel" Orientation="Horizontal" 
        HorizontalAlignment="Center" Visibility="Collapsed"> 
      <TextBlock HorizontalAlignment="Center" Text="Your Moves: " TextWrapping="Wrap" 
        Foreground="#FFD0D0D0" FontSize="17.333"/> 
      <TextBlock x:Name="TotalMovesTextBlock" HorizontalAlignment="Center" Text="N" 
        TextWrapping="Wrap" Foreground="#FFFFB000" FontSize="17.333"/> 
     </StackPanel> 
    </StackPanel> 
    <!-- Here i can see anything under this comment --> 
    <StackPanel Orientation="Vertical" VerticalAlignment="Top" Grid.Row="1"> 
     <Border x:Name="CongratsBorder" Height="30" Background="#FFF10DA2" 
       HorizontalAlignment="Center" 
       Width="443" RenderTransformOrigin="0.5,0.5" 
       UseLayoutRounding="False" Opacity="0"> 
      <Border.RenderTransform> 
       <TransformGroup> 
        <ScaleTransform /> 
        <SkewTransform /> 
        <RotateTransform /> 
        <TranslateTransform /> 
       </TransformGroup> 
      </Border.RenderTransform> 
      <TextBlock HorizontalAlignment="Center" Text="CONGRATULATIONS!" TextWrapping="Wrap" 
         Foreground="White" FontSize="17.333" VerticalAlignment="Center" 
         FontWeight="Bold"/> 
     </Border> 
     <Border x:Name="border" BorderThickness="3" Background="#FF262626" 
       HorizontalAlignment="Center" VerticalAlignment="Center" Padding="1" 
       RenderTransformOrigin="0.5,0.5"> 
      <Border.RenderTransform> 
       <TransformGroup> 
        <ScaleTransform /> 
        <SkewTransform /> 
        <RotateTransform /> 
        <TranslateTransform /> 
       </TransformGroup> 
      </Border.RenderTransform> 
      <Border.BorderBrush> 
       <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" > 
        <GradientStop Color="#FFF10DA2" Offset="0" /> 
        <GradientStop Color="#FFEE7923" Offset="1" /> 
       </LinearGradientBrush> 
      </Border.BorderBrush> 
      <Canvas Height="435" Width="435"> 
       <Image x:Name="PreviewImage" Height="435" Width="435" Opacity="0.2" /> 
       <Canvas x:Name="GameContainer" Height="435" Width="435" /> 
      </Canvas> 
     </Border> 
     <TextBlock x:Name="TapToContinueTextBlock" HorizontalAlignment="Center" 
        Text="Tap the picture to start the puzzle" 
        TextWrapping="Wrap" Foreground="#FFD0D0D0" FontSize="17.333" /> 
    </StackPanel> 

    <!--TitlePanel contains the name of the application and page title--> 
    <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> 

    <!--ContentPanel - place additional content here--> 
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"></Grid> 
</Grid> 

<!--Sample code showing usage of ApplicationBar--> 
<!--<phone:PhoneApplicationPage.ApplicationBar> 
    <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True"> 
     <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/> 
     <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/> 
     <shell:ApplicationBar.MenuItems> 
      <shell:ApplicationBarMenuItem Text="MenuItem 1"/> 
      <shell:ApplicationBarMenuItem Text="MenuItem 2"/> 
     </shell:ApplicationBar.MenuItems> 
    </shell:ApplicationBar> 
</phone:PhoneApplicationPage.ApplicationBar>--> 

回答

5

你已經有了一個網格

而你是網格的第一行中有許多東西 - 所以他們在彼此的頂部排出。

  • 嘗試將東西放入不同的網格行
  • 或嘗試一個StackPanel更換您最電網呢?

而且<RowDefinition Height="0.2"/>似乎是一個高度相當小 - 嘗試使用Height="Auto"

3

你的第一個StackPanel中沒有一個Grid.Row設置。這也許是TitlePanel落後於行0

+0

好的,但是當我刪除TitlePanel和的ContentPanel它是沒有diffrence – harry180 2011-04-04 18:41:23

+0

該行可能沒有足夠大的顯示按鈕。如果你的意圖是把它放在那一行,你仍然會最終使它與那行內容相得益彰。 – 2011-04-04 18:45:29

相關問題