我从我正在开发的应用程序创建了一个测试应用程序。我有一个listpicker与一组颜色出于某种原因,当它进入全模式选择没有被更新。listpicker fullmode没有更新选项
我已经下载了2个这样的例子,我没有看到我错过了什么。感谢
<phone:PhoneApplicationPage.Resources>
<DataTemplate x:Name="lstColorsItemTemplate">
<StackPanel Orientation="Horizontal">
<Rectangle Fill="{Binding pickedColorBlock}" Height="30" Width="30"/>
<TextBlock Text="{Binding pickedColor}" Foreground="{StaticResource PhoneAccentBrush}" Margin="10,0,0,0" />
</StackPanel>
</DataTemplate>
<DataTemplate x:Name="fulllstColorsItemTemplate" >
<StackPanel Orientation="Horizontal" >
<Rectangle Fill="{Binding pickedColorBlock}" Height="30" Width="30" Margin="0,0,10,10" />
<TextBlock Text="{Binding pickedColor}" Foreground="{StaticResource PhoneAccentBrush}" Margin="10,0,0,0" FontSize="20" />
</StackPanel>
</DataTemplate>
</phone:PhoneApplicationPage.Resources>
<StackPanel Orientation="Horizontal" Margin="13,113,143,0">
<toolkit:ListPicker x:Name="lstColors" Width="225"
ItemTemplate="{StaticResource lstColorsItemTemplate}"
FullModeItemTemplate="{StaticResource fulllstColorsItemTemplate}"
Header="Font Color"
BorderBrush="{StaticResource PhoneAccentBrush}"
Background="#FFF4F4F5"
CacheMode="BitmapCache"/>
</StackPanel>
后面的代码
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) //without ToDoTableEntries not set as observablcollection throws null error (never counts up)
{
List<colorChoices> source = new List<colorChoices>();
source.Add(new colorChoices() { pickedColorBlock = Colors.Black.ToString(), pickedColor = "Black", pickedSolidColorBrush = new SolidColorBrush(Colors.Black) });
source.Add(new colorChoices() { pickedColorBlock = Colors.White.ToString(), pickedColor = "White", pickedSolidColorBrush = new SolidColorBrush(Colors.White) });
source.Add(new colorChoices() { pickedColorBlock = Colors.Red.ToString(), pickedColor = "Red", pickedSolidColorBrush = new SolidColorBrush(Colors.Red) });
source.Add(new colorChoices() { pickedColorBlock = Colors.Brown.ToString(), pickedColor = "Brown", pickedSolidColorBrush = new SolidColorBrush(Colors.Brown) });
source.Add(new colorChoices() { pickedColorBlock = Colors.Blue.ToString(), pickedColor = "Blue", pickedSolidColorBrush = new SolidColorBrush(Colors.Blue) });
source.Add(new colorChoices() { pickedColorBlock = Colors.Gray.ToString(), pickedColor = "Gray", pickedSolidColorBrush = new SolidColorBrush(Colors.Gray) });
lstColors.ItemsSource = source;
}
class colorChoices
{
public string pickedColorBlock { get; set; }
public string pickedColor {get; set;}
public SolidColorBrush pickedSolidColorBrush {get; set;}
}
你是什么意思,它没有得到更新?你的意思是你不知道FullScreenMode中的哪个项目是SelectedItem? – 2014-10-17 00:19:40
对不起,当我点击我的列表时,它将带我到全模式屏幕我选择我的新颜色,它将我返回到我的原始页面,但SelectedItem不会更改它保持第一个选项。 – branedge 2014-10-17 01:58:41