将wp8升级到wp8.1 silverlight,初始化组件时出现列表选择器错误
本文关键字:wp8 选择器 错误 组件 列表 silverlight 初始化 | 更新日期: 2023-09-27 18:03:29
升级到Wp8.1 silverlight后,当InitializeComponent();
执行时,我的列表选择器在运行时失败。
列表选择器来自的WPtoolKit已更新,但我的解决方案仍然是:'packages'WPtoolkit.4.2013.08.16'lib'wp8'Microsoft.Phone.Controls.Toolkit.dll
。
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
.
.
.
<StackPanel Grid.Row="0" Grid.RowSpan="3" Orientation="Horizontal" >
<toolkit:ListPicker x:Name="LP_Map" Width="284" Template="{StaticResource ListPicker_ChooseCountry_CreateGame_test}" BorderBrush="#FF884900">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<cmd:EventToCommand Command="{Binding ChangeMapCommand}" CommandParameter="{Binding ElementName=LP_Map}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<toolkit:ListPickerItem Background="#FFAB7D33" Content="Europe1328WithWater" Foreground="Black" Style="{StaticResource ListPickerItem_CreateGame_ChooseCountry_test}" />
</toolkit:ListPicker>
<toolkit:ListPicker x:Name="Player_LP" Width="150" SelectionChanged="SelChangedCommand" BorderBrush="#FF884900" Foreground="Black">
<toolkit:ListPickerItem Background="#FFAB7D33" Content="2 Players" Foreground="Black" FontFamily="Andalus" />
<toolkit:ListPickerItem Background="#FFAB7D33" Content="3 Players" FontFamily="Andalus" />
<toolkit:ListPickerItem Background="#FFAB7D33" Content="4 Players" FontFamily="Andalus" />
</toolkit:ListPicker>
</StackPanel>
我不明白为什么我得到一个XAML解析错误,是否有一些我需要更新显式或改变解决方案的重新定位后?
注意使用MVVMLight的EventToCommand不是问题,这已经更新为使用参数包。
ComboBox在Windows Phone 8.1 Silverlight中不可用
我目前正在使用WP8.1 Silverlight解决方案,使用最新版本的WP phonetoolkit。使用ListPicker没有问题。下面是示例:
xmlns:Local="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
<toolkit:ListPicker
x:Name="MyListBox"
BorderBrush="{StaticResource AppBackground}"
Foreground="{StaticResource AppTextColor}"
ItemsSource="{Binding Categories}">
<Local:Interaction.Triggers>
<Local:EventTrigger EventName="SelectionChanged">
<Local:InvokeCommandAction Command="{Binding DataContext.OpenCategoryCMD, ElementName=LayoutRoot}"
CommandParameter="{Binding ElementName=MyListBox, Path=SelectedIndex}"/>
</Local:EventTrigger>
</Local:Interaction.Triggers>
</toolkit:ListPicker>
And in ViewModel:
private void OpenCategory(int categoryIndex) { ... }