Почему я не вижу кнопку в приложении Windows Phone 7? - PullRequest
1 голос
/ 04 апреля 2011

как в заголовке:)

Я написал из учебника: 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>-->

Ответы [ 2 ]

5 голосов
/ 04 апреля 2011

У вас есть сетка

И у вас есть несколько вещей в первом ряду этой Решетки - поэтому они нарисованы друг на друге.

  • Попробуйте поместить вещи в разные строки сетки
  • Или попробуйте заменить вашу внешнюю сетку на StackPanel?

Также <RowDefinition Height="0.2"/> кажется довольно маленьким для высоты - попробуйте использовать Height="Auto"

3 голосов
/ 04 апреля 2011

Ваша первая стек-панель не имеет настройки Grid.Row.Это, вероятно, позади TitlePanel в строке 0.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...