我有一個Windows Phone 8應用程序。我的應用程序使用Toolkit中的ListPicker。我的應用顯示得很好。但是,當我展開ListPicker時,背景是白色。我無法讀取任何項目的文字。當ListPicker被摺疊時,我可以很好地讀取所選項目的文本。這裏是我的代碼:Windows Phone工具包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>
我在做什麼錯?
這可能是由工具包的錯誤引起的。它可以通過將ListPicker的ItemsSource綁定到ObservableCollection來解決 – Hong