ListPicker只显示第一项?

时间:2014-01-03 08:58:23

标签: xaml windows-phone-7 windows-phone windows-phone-toolkit

我正在使用Windows Phone Toolkit(通过NuGet安装的最新版本)在我的Windows Phone页面上创建ListPicker。我已经定义了一个简单的ListPicker,如下所示:

<toolkit:ListPicker Name="lstPicker">
   <toolkit:ListPickerItem Content="First Item" />
   <toolkit:ListPickerItem Content="Second Item" />
   <toolkit:ListPickerItem Content="Third Item" />
</toolkit:ListPicker>

但是当我运行应用程序时,我看到的只是第一项。搜索过后我可以看到这是2011年的一个老版本的错误(only the first listpicker opens windows phone)但是我从Nuget安装后应该有最新版本。我也尝试从CodePlex下载源代码并引用本地构建但我遇到同样的问题。

这是一个Windows Phone 7.1应用程序,因此我引用了WP7程序集。

任何人都知道在应用程序中可能导致这种情况的原因吗?

由于

1 个答案:

答案 0 :(得分:0)

查看ListPickerMode属性。

正常(这是默认值) - 只有所选项目在原始pag上可见。 展开 - 所有项目都在原始页面上可见。 完整的所有项目在单独的弹出窗口中可见。

我尝试了你的xaml,它对我来说很好。我引用了Aug13工具包。这是我的完整xaml:

<phone:PhoneApplicationPage 
x:Class="ListpickerExpanding.MainPage"
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"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">

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

    <!--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">
        <toolkit:ListPicker Name="lstPicker">
            <toolkit:ListPickerItem Content="First Item" />
            <toolkit:ListPickerItem Content="Second Item" />
            <toolkit:ListPickerItem Content="Third Item" />
        </toolkit:ListPicker>
    </Grid>
</Grid>

I see this when I run it and tap on the control

如果您仍有问题,请在此处粘贴完整的xaml。

相关问题