列表滚动条无法正常工作wp8

时间:2014-03-18 06:11:34

标签: c# windows-phone-8

当我尝试向下滚动时,

列表框滚动条无法正常工作。这是我的代码,我在弹出窗口中打开此页面。如何解决这个问题。请帮助.thankyou .............................................. .................................................. .................................................. ..................................

 <phone:PhoneApplicationPage
    x:Class="PdfReader.Views.BookMark"
    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"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="True" >

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

        <!--TitlePanel contains the name of the application and page title-->
        <!--<StackPanel Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock 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="0,0,0,0">
            <StackPanel Background="#6c4a7d"  Width="auto"   Margin="0,248,0,95">
                <StackPanel Orientation="Horizontal">
                    <Button x:Name="btnCancel" Content="Cancel" Click="btnCancel_Click"/>
                    <TextBlock Text="BookmarkList" VerticalAlignment="Center" Margin="100 0 0 0"></TextBlock>
                    <Button  Margin="70,0,0,0" Background="Transparent" HorizontalAlignment="Left"  BorderBrush="Transparent" Width="80" Height="70"  Name="DeleteAll" Click="DeleteAll_Click" Canvas.ZIndex="10" >
                        <StackPanel Width="68" Height="60" Margin="0,-5,-40,-14" UseLayoutRounding="False" RenderTransformOrigin="0.45,0.5" >
                            <StackPanel.Projection>
                                <PlaneProjection RotationX="24" RotationY="9"/>
                            </StackPanel.Projection>
                            <StackPanel.RenderTransform>
                                <CompositeTransform TranslateX="-1" TranslateY="-12"/>
                            </StackPanel.RenderTransform>
                            <TextBlock Visibility="Collapsed" Text="{Binding Bookname}"></TextBlock>
                            <TextBlock Visibility="Collapsed" Text="{Binding Pageno}"></TextBlock>
                            <Image Source="/Assets/delete_bookmark.png"  Width="74" Height="65"
      HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8,-4,11,570" Canvas.ZIndex="62" RenderTransformOrigin="0.55,0.5">
                                <Image.Projection>
                                    <PlaneProjection CenterOfRotationX="0.1" LocalOffsetX="-1"/>
                                </Image.Projection>
                                <Image.RenderTransform>
                                    <CompositeTransform TranslateX="1" ScaleX="0.95"/>
                                </Image.RenderTransform>
                            </Image>
                        </StackPanel>
                    </Button>
                    <!--<Button x:Name="btnOK" Content="OK"/>-->

                </StackPanel>


                <ListBox Name="Bookmark_List" SelectionChanged="Bookmark_List_SelectionChanged"    >
                    <ListBox.ItemTemplate >
                        <DataTemplate>
                            <Grid Margin="10 10 10 10">
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{Binding Bookname}" Foreground="White" VerticalAlignment="Center"></TextBlock>

                                    <TextBlock Text="{Binding Pageno}" FontSize="29" VerticalAlignment="Center" Margin="30 0 0 0" Foreground="White"></TextBlock>
                                    <!--<Button  Margin="5 0 0 0" Background="Transparent" HorizontalAlignment="Right"  BorderBrush="Transparent" Width="80" Height="70"  Name="DeleteBookmark" Click="DeleteBookmark_Click" >
                                        <StackPanel>
                                            <TextBlock Visibility="Collapsed" Text="{Binding Bookname}"></TextBlock>
                                            <TextBlock Visibility="Collapsed" Text="{Binding Pageno}"></TextBlock>
                                            <Image Source="/Assets/delete_bookmark.png"  Width="62" Height="100"
      HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                        </StackPanel>
                                    </Button>-->
                                    <Button  Margin="5 0 0 0" Background="Transparent" HorizontalAlignment="Right"  BorderBrush="Transparent" Width="80" Height="70" Click="DeleteBookmark_Click" Name="DeleteBookmark" >
                                        <StackPanel >
                                            <TextBlock Visibility="Collapsed" Text="{Binding Bookname}"></TextBlock>
                                            <TextBlock Visibility="Collapsed" Text="{Binding Pageno}"></TextBlock>
                                            <Image Source="/Assets/delete_book.png" Width="45" Height="30"
      HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                        </StackPanel>
                                    </Button>

                                </StackPanel>
                            </Grid>
                        </DataTemplate>

                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
        </Grid>


    </Grid>

</phone:PhoneApplicationPage>

1 个答案:

答案 0 :(得分:0)

请将高度应用于列表框并设置ScrollViewer.VerticalScrollBarVisibility

 <ListBox Name="Bookmark_List" Height="450" ScrollViewer.VerticalScrollBarVisibility="Visible"  SelectionChanged="Bookmark_List_SelectionChanged"    >