【问题标题】:Issue with List picker FullModeItemTemplate template列表选择器 FullModeItemTemplate 模板的问题
【发布时间】:2013-09-09 04:22:17
【问题描述】:

我在我的 WP8 应用程序中使用 Listpicker 控件,其中 FullModeItemTemplate 被定义为显示自定义选项列表,并且我将 SelectionMode 启用为 Multiple,以便用户可以从 Listpicker 中选择多个选项。在后面的代码上,我正在绑定文本。

我的主要问题是,在我的全模式 xaml 输出下方,每个列表项之间有很多可用空间。我无法弄清楚如何最小化...之间的差距

<toolkit:ListPicker x:Name="userCountryList" ItemsSource="{Binding CountryList}"  Header="Choose a country or region:"  SelectionMode="Multiple" FullModeItemTemplate="{StaticResource DataTemplate2}" />

<phone:PhoneApplicationPage.Resources>
    <DataTemplate x:Key="DataTemplate2">
        <StackPanel Orientation="Horizontal">
           <TextBlock HorizontalAlignment="Left"  FontSize="28" TextWrapping="Wrap" Text="{Binding CountryName}" VerticalAlignment="Center" Width="Auto"/>
        </StackPanel>
    </DataTemplate>
</phone:PhoneApplicationPage.Resources>

当前全模式输出如下:

【问题讨论】:

    标签: xaml windows-phone-8 listpicker


    【解决方案1】:

    替换

    <TextBlock HorizontalAlignment="Left"  FontSize="28" TextWrapping="Wrap" Text="{Binding CountryName}" VerticalAlignment="Center" Width="Auto"/>
    

     <TextBlock HorizontalAlignment="Left"  FontSize="28"  Margin="10,5,0,20" TextWrapping="Wrap" Text="{Binding CountryName}" VerticalAlignment="Center" Width="Auto" />
    

    也就是说我们刚刚修改了margin字段。 此外,您还可以编辑这些边距值 Margin="Left, Top, Right, Bottom"。 也允许负缩进。

    希望这会有所帮助。祝你好运。

    【讨论】:

    • 这并没有解决问题,即使我尝试使用 Margin="0" - 布局没有变化。看起来 listpicker(工具包)没有公开为每个项目调整此自定义项。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-03
    相关资源
    最近更新 更多