1

我有一个 Windows Phone 8 应用程序。我的应用程序使用 Toolkit 中的 ListPicker。我的应用程序看起来很好。但是,当我展开 ListPicker 时,背景是白色的。我无法阅读任何项目的文字。当 ListPicker 折叠时,我可以很好地阅读所选项目的文本。这是我的代码:

<Grid x:Name="myGrid" Background="Black" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
  <Grid.RowDefinitions>
    <RowDefinition Height="Auto" />                    
    <RowDefinition Height="*" />
  </Grid.RowDefinitions>

  <Grid.RenderTransform>
    <TranslateTransform x:Name="myGridTransform" />
  </Grid.RenderTransform>

  <Grid Background="Silver" VerticalAlignment="Stretch">
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <TextBlock Text="app name" Margin="24,6,0,0" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Left" Style="{StaticResource PhoneTextSmallStyle}" />
    <TextBlock Text="PAGE" Margin="24,0,0,6" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Left" Style="{StaticResource PhoneTextLargeStyle}" />
  </Grid>

  <ScrollViewer Grid.Row="1" Margin="8,0,8,0">
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>

      <TextBlock HorizontalAlignment="Left" Grid.Row="0" TextWrapping="Wrap" Text="Group" VerticalAlignment="Top" Style="{StaticResource PhoneTextGroupHeaderStyle}" Margin="12,12,12,0" />
      <TextBlock HorizontalAlignment="Left" Grid.Row="1" TextWrapping="Wrap" Text="label" VerticalAlignment="Top" Style="{StaticResource PhoneTextLargeStyle}"/>
      <toolkit:ListPicker x:Name="myListPicker" Grid.Row="2" Margin="12,-6,12,-2" Background="Transparent" Loaded="myListPicker_Loaded">
        <toolkit:ListPicker.Items>
          <toolkit:ListPickerItem Tag="1" Content="Option 1" />
          <toolkit:ListPickerItem Tag="2" Content="Option 2" />
        </toolkit:ListPicker.Items>
      </toolkit:ListPicker>
      <TextBlock HorizontalAlignment="Left" Grid.Row="3" Margin="12,0,12,8" TextWrapping="Wrap" Text="other details." VerticalAlignment="Top" Style="{StaticResource PhoneTextSmallStyle}" />
    </Grid>
  </ScrollViewer>
</Grid>

我究竟做错了什么?

4

3 回答 3

0

我认为那是因为您的设备或模拟器在浅色主题下

尝试更新扩展的视觉状态背景

于 2013-06-12T13:12:49.763 回答
0

我遇到了这个问题,ListBox在增加ListBox. 问题出在父容器上。当上下文超过特定高度时,不知何故Grid的孩子不遵守背景颜色。尝试替换GridStackPanel您的父容器并将每个孩子的背景颜色设置为您想要的颜色。应该管用。

于 2013-11-12T05:35:35.767 回答
0

不使用属性内容,而是将 ListPickerItem 的文本添加到标签本身的 usinf 中。像这样:

<toolkit:ListPicker x:Name="myListPicker">
    <sys:String>Option 1</sys:String>
    <sys:String>Option 2</sys:String>
</toolkit:ListPicker>
于 2013-06-20T21:09:35.390 回答