Scrollviewer无法正常工作

时间:2013-10-11 13:20:29

标签: xaml scrollview windows-phone-7.1

我无法让scrollviewer正常工作!该列表不可滚动。也许你可以帮助我:)。

<Grid x:Name="grid">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <ScrollViewer Margin="0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                    <StackPanel VerticalAlignment="Top">
                        <ListBox x:Name="KommentareListView" ItemsSource="{Binding}"  Foreground="White" >
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid  Margin="0,0,0,0">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition/>
                                        </Grid.ColumnDefinitions>
                                        <StackPanel Grid.Column="0" Background="#FF0083FF" Width="10" />
                                        <StackPanel Margin="10,5,10,5" Grid.Column="1">
                                            <TextBlock Text="{Binding Kommentar}"  
                                                FontSize="16" Margin="0,0,0,0" TextWrapping="Wrap" Foreground="Black"/>
                                            <StackPanel Orientation="Horizontal" >
                                                <TextBlock Text="{Binding Author}" 
                                                    FontSize="12" Margin="0,0,0,0" Foreground="Black"/>
                                                <TextBlock Text="{Binding Date}" 
                                                    FontSize="12" Margin="30,0,0,0" Foreground="Black"/>
                                            </StackPanel>
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                        <Button x:Name="mehrKommentareLaden" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,10,0,0" Height="45" Visibility="Collapsed" Content="mehr Kommentare laden" Click="mehrKommentareLaden_Click" />
                    </StackPanel>
                </ScrollViewer>
                <StackPanel HorizontalAlignment="Left" VerticalAlignment="Bottom" Grid.Row="1">
                    <StackPanel x:Name="AnmeldenPanel" VerticalAlignment="Bottom" Width="456" Visibility="Collapsed">
                        <Button x:Name="AnmeldenButton" Content="Anmelden" VerticalAlignment="Center" BorderBrush="Black" Foreground="Black" Margin="0" Click="AnmeldenButton_Click"/>
                        <TextBlock TextWrapping="Wrap" Text="Du musst dich anmelden, um Kommentare zu verfassen." Margin="15,0,0,0"/>
                    </StackPanel>
                    <toolkit:PhoneTextBox x:Name="KommentarBox" Hint="Dein Kommentar..." LengthIndicatorVisible="True" LengthIndicatorThreshold="10" DisplayedMaxLength="240" TextWrapping="Wrap" Background="#BFB2B2B2" BorderBrush="#BFFFFFFF" Foreground="#91000000" SelectionBackground="#FF0083FF" SelectionForeground="White" Style="{StaticResource PhoneTextBoxWhiteBackground}" Height="74" Width="456"/>
                </StackPanel>
                <!--<Controls:WatermarkTextBox x:Name="KommentarTextBox" Margin="0,0,100,20" TextWrapping="Wrap" Watermark="Dein Kommentar...." Height="30" VerticalAlignment="Center"  FontFamily="Calibri" FontSize="17.333" BorderBrush="#CC000000"/>-->
            </Grid>

1 个答案:

答案 0 :(得分:0)

尝试将List高度设置为自动,将其他所有内容设置为ListScrollView之间的自动,就像您拥有StackPanel一样。