簡體   English   中英

將wp8升級到wp8.1 silverlight,初始化組件時出現Listpicker錯誤

[英]Upgrading wp8 to wp8.1 silverlight, Listpicker error upon initialize component

當我升級到Wp8.1 silverlight之后,當InitializeComponent();運行時,我的列表選擇器將失敗InitializeComponent(); 被執行。

列表選擇器所在的WPtoolKit已更新,但仍在我的解決方案中: \\packages\\WPtoolkit.4.2013.08.16\\lib\\wp8\\Microsoft.Phone.Controls.Toolkit.dll

列表選擇器顯示在xaml設計視圖中,代碼為:

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中不可用。

我目前正在使用WP phonetoolkit的最新版本來開發WP8.1 Silverlight解決方案。 使用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>

在ViewModel中:

private void OpenCategory(int categoryIndex) { ... }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM