Windows Phone 7的ListPicker控件未打开完整选择窗口

时间:2011-05-25 19:08:10

标签: c# windows-phone-7 listpicker

以下是空闲时的样子:

enter image description here

在这里,当我点击它时,它应该弹出全屏选择模式(根据我读过的内容):

enter image description here

如您所见,它似乎没有打开全屏选择模式。

这是我的XAML:

<phone:PhoneApplicationPage 
    x:Class="GameLense.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">

    <Grid>
        <Grid.Resources>
            <DataTemplate x:Name="PickerItemTemplate">
                <StackPanel Orientation="Horizontal">
                    <Border Background="Transparent" Width="34" Height="34">
                        <Image Source="{Binding ImagePath}" Margin="12 0 0 0" 
                               VerticalAlignment="Center" 
                               HorizontalAlignment="Center" 
                               Stretch="Fill"/>
                    </Border>
                    <TextBlock Text="{Binding Name}" Margin="12 0 0 0"/>
                </StackPanel>
            </DataTemplate>
            <DataTemplate x:Name="PickerFullModeItemTemplate">
                <StackPanel Orientation="Horizontal">
                    <Border Background="Gold" Width="34" Height="34">
                        <Image Source="{Binding ImagePath}" Margin="12 0 0 0" VerticalAlignment="Center" HorizontalAlignment="Center" />
                    </Border>
                    <TextBlock Text="{Binding Name}" Margin="12 0 0 0"/>
                </StackPanel>
            </DataTemplate>
        </Grid.Resources>

        <Grid.RowDefinitions>
            <RowDefinition Height="100" />
            <RowDefinition />
        </Grid.RowDefinitions>

        <!--Begin Top Bar -->
        <Image Grid.Row="0" Source="Images/topbarBg.png" Stretch="Fill" />
        <TextBlock Text="Console" HorizontalAlignment="Left" 
                   VerticalAlignment="Center" FontSize="35" 
                   Padding="10"/>

        <toolkit:ListPicker x:Name="lstPlatform" 
                            ListPickerMode="Full"
                            Grid.Row="0" CacheMode="BitmapCache"
                            Margin="160 0 10 0" VerticalAlignment="Center"
                            ItemTemplate="{StaticResource PickerItemTemplate}" 
                            FullModeItemTemplate="{StaticResource PickerFullModeItemTemplate}" />

        <!--End Top Bar -->

    </Grid>

</phone:PhoneApplicationPage>

关于我可能做错的任何想法?

3 个答案:

答案 0 :(得分:7)

您已在ListPicker控件上设置ItemCountThreshold="0",以便立即进入全屏选择模式。

答案 1 :(得分:6)

您还可以在listpicker上设置ExpansionMode="FullScreenOnly"来解决此问题。

答案 2 :(得分:1)

控件将包含在Grid.Row中,并将遵守其大小限制。话虽如此,它不会越过第二排的边界。您需要将其放在另一个具有较大高度的Grid.Row内或在弹出窗口中打开它。