Автоматическое растяжение отображается в Expression, а Visual Studio не выполняется в эмуляторе - PullRequest
1 голос
/ 15 декабря 2010

это xaml для него, когда я пытаюсь прокрутить с помощью средства просмотра прокрутки, второй элемент управления не растягивается, чтобы вместить все данные.

<phone:PhoneApplicationPage xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"  
    x:Class="CheeroJusa.Views.RecipeView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    d:DataContext="{d:DesignData ../SampleData/MainViewModelSampleData.xaml}"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" shell:SystemTray.IsVisible="True" d:DesignHeight="696" d:DesignWidth="480">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <ScrollViewer x:Name="LayoutRoot" Background="Transparent">
        <!--ContentPanel - place additional content here-->
        <StackPanel x:Name="TitlePanel" Width="480" >
            <TextBlock x:Name="PageTitle" Text="{Binding SelectedRecipe.Name}" Margin="0,-7,-4,0" Style="{StaticResource PhoneTextTitle2Style}" Height="44" />
            <Canvas x:Name="grid1" Height="2000" VerticalAlignment="Top" Margin="8,0">
                <TextBlock Height="30" HorizontalAlignment="Left" x:Name="textBlock1" Text="Prep Time" Width="93" Foreground="{StaticResource PhoneForegroundBrush}" Canvas.Left="17" Canvas.Top="1" />
                <TextBlock Height="30" x:Name="textBlock2" Text="Cook Time" Foreground="{StaticResource PhoneForegroundBrush}" Canvas.Left="158" Canvas.Top="1" Width="113" />
                <TextBlock Height="30" HorizontalAlignment="Left" x:Name="textBlock3" Text="Serves" Width="58" Foreground="{StaticResource PhoneForegroundBrush}" Canvas.Left="353" Canvas.Top="1" />
                <TextBlock Height="44" HorizontalAlignment="Left" x:Name="txtPrep" Text="{Binding SelectedRecipe.PrepTime}" Width="90" TextAlignment="Center" Canvas.Left="17" Canvas.Top="28" />
                <TextBlock Height="44" HorizontalAlignment="Left" x:Name="txtCook" Text="{Binding SelectedRecipe.CookTime}" Width="90" TextAlignment="Center" Canvas.Left="162" Canvas.Top="29" />
                <TextBlock Height="44" HorizontalAlignment="Left" x:Name="txtServe" Text="{Binding SelectedRecipe.Serves}" Width="58" TextAlignment="Center" Canvas.Left="353" Canvas.Top="28" />
                <Grid x:Name="gridScrollView" Height="Auto" Canvas.Left="8" Canvas.Top="59" Width="481">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid Margin="0,0,8,0" Grid.Row="0" >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <TextBlock x:Name="textBlock5" Text="Ingredients" HorizontalAlignment="Left" Margin="0" FontSize="29.333" Height="59" VerticalAlignment="Top" d:LayoutOverrides="HorizontalAlignment">
                            <TextBlock.Foreground>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="Black" Offset="0" />
                                    <GradientStop Color="White" Offset="1" />
                                </LinearGradientBrush>
                            </TextBlock.Foreground></TextBlock>
                        <ItemsControl  x:Name="ingList" ItemsSource="{Binding SelectedRecipe.ingredients}" Background="Transparent" Margin="9,59,0,0" d:LayoutOverrides="Height">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <Grid x:Name="grid5" Height="Auto" VerticalAlignment="Stretch">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
                                        <TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextLargeStyle}" Margin="12,0,12,11" d:LayoutOverrides="Height" />
                                        <!--<toolkit:Separator BorderThickness="1" Width="410" Margin="20,0,19,4" VerticalAlignment="Bottom">
                                            <toolkit:Separator.BorderBrush>
                                                <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                                    <GradientStop Color="Black" Offset="0" />
                                                    <GradientStop Color="White" Offset="1" />
                                                </LinearGradientBrush>
                                            </toolkit:Separator.BorderBrush>
                                        </toolkit:Separator>-->
                                    </Grid>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </Grid>
                    <!--<toolkit:Separator Height="12" Margin="0,221,0,0" VerticalAlignment="Top" d:LayoutOverrides="Width" />-->
                    <Grid d:LayoutOverrides="GridBox" Margin="0,0,0,0" Grid.Row="2" VerticalAlignment="Stretch">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <TextBlock x:Name="textBlock4" Text="Instructions" HorizontalAlignment="Left" FontSize="29.333" Height="55" VerticalAlignment="Top" d:LayoutOverrides="HorizontalAlignment">
                            <TextBlock.Foreground>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="Black" Offset="0" />
                                    <GradientStop Color="White" Offset="1" />
                                </LinearGradientBrush>
                            </TextBlock.Foreground></TextBlock>
                        <ItemsControl x:Name="lstSteps" ItemsSource="{Binding SelectedRecipe.steps}" HorizontalContentAlignment="Stretch" UseLayoutRounding="True" Margin="5,55,0,0" d:LayoutOverrides="Height" >
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <Grid Height="Auto">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>                                            
                                        </Grid.RowDefinitions>
                                        <TextBlock Text="{Binding StepOrder}" TextWrapping="Wrap" Style="{StaticResource PhoneTextLargeStyle}" HorizontalAlignment="Left" Margin="12,0,0,0" Width="23" d:LayoutOverrides="GridBox" />
                                        <TextBlock Text="{Binding Text}" TextWrapping="Wrap" Style="{StaticResource PhoneTextLargeStyle}" Margin="35,0,19,0" d:LayoutOverrides="GridBox" />
                                    </Grid>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </Grid>
                    <!--<toolkit:Separator Margin="0,221,0,0" Height="12" BorderThickness="1" VerticalAlignment="Bottom" Grid.Row="3">
                        <toolkit:Separator.BorderBrush>
                            <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                <GradientStop Color="Black" Offset="0" />
                                <GradientStop Color="White" Offset="1" />
                            </LinearGradientBrush>
                        </toolkit:Separator.BorderBrush>
                    </toolkit:Separator>-->


                </Grid>
            </Canvas>
        </StackPanel>
    </ScrollViewer>
    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

    <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>    
</phone:PhoneApplicationPage>

Введите последний код 12/31/2010

высота 2000 для холста как раз для того, чтобы тестировать вещи, делая это "автоматически", это должно быть намного короче.

Ответы [ 2 ]

0 голосов
/ 03 января 2011

Хорошо. Наконец-то я исправил это, установив вертикальное выравнивание по верху для второго элемента управления, и кажется, что оно растягивается нормально ... хотя на самом деле не могу ответить почему: (..

0 голосов
/ 16 декабря 2010

Попробуйте упаковать содержимое вашего ScroillViewer в один контейнер.т.е. StackPanel или другая сетка.

...