0

改天另一个问题,这一次我想与 XAML 格式的一个简单问题。

我在 WP7 应用程序的 XAML 页面上的 StackPanel 中有一个 ListPicker。每当我点击 ListPicker 时,它都会展开,但它似乎在它下面的项目后面展开。如果列表中有足够的项目,它会以全屏模式打开,效果很好。

任何建议,指针将不胜感激;

<Grid Name="grdBought">

<StackPanel Visibility="Visible" Margin="0,0,0,0" Height="480">
    <Button Name="btnSave" Grid.Row="0" Content="Save" Height="100" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Width="378" Click="btnSave_Click" />

        <StackPanel Grid.Row="1" Orientation="Vertical">


            <toolkit:ListPicker Name="CategoryPicker" Header="Select Category" HorizontalAlignment="Left" ItemsSource="{Binding Categories}" CacheMode="BitmapCache" TabIndex="0" Margin="0,0,0,0" SelectionChanged="CategoryPicker_SelectionChanged" Height="100" Width="195">
                <toolkit:ListPicker.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Vertical" HorizontalAlignment="Left">
                            <TextBlock Text="{Binding CategoryDesc}" FontFamily="{StaticResource PhoneFontFamilySemiBold}" FontSize="{StaticResource PhoneFontSizeMediumLarge}" />
                        </StackPanel>
                    </DataTemplate>
                </toolkit:ListPicker.ItemTemplate>

                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <StackPanel Name="item" Orientation="Vertical" Margin="0, 0, 0, 0">
                            <TextBlock Margin="0, 0, 0, 0" Text="{Binding CategoryDesc}" FontSize="40" TextWrapping="Wrap" />
                        </StackPanel>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>


            <StackPanel Name="Items" Grid.Row="1" Orientation="Horizontal">
                <TextBox Name="txtDescription" Height="100" Margin="0,0,0,0" Text="" Width="225" MaxLength="100" FontSize="40" InputScope="Text" />
                <TextBox Name="txtAmount" HorizontalAlignment="Left" Text="0.00" Height="100" Margin="0,0,0,0" TextAlignment="Right" FontSize="40" FontFamily="Segoe WP Semibold" Width="163" KeyUp="txtAmount_KeyUp" />
            </StackPanel>

        </StackPanel>

    <TextBlock Name="tb1" Text="Amount" Height="27" Margin="0,0,0,0" Width="137" />
    <Button Name="button1" Content="Button" Height="72" HorizontalAlignment="Left" Margin="249,0,0,0" VerticalAlignment="Top" Width="160" Click="button1_Click" />

</StackPanel>

我已经浏览了 windowsphonegeek.com 网站上的示例,但我仍然无法使其工作!

4

2 回答 2

3

问题是您将 ListPicker 的高度设置为 100。删除它,然后保留为自动。当您限制高度时,这是一个问题 b/c,列表选择器无处可扩展(因此,显示您所看到的行为)

于 2012-02-13T18:49:04.030 回答
0

I guess height is creating an issue, just make sure that height of listpicker is greater than stackpanel.

于 2012-05-12T09:43:56.103 回答