0

我的一位用户对 listpicker 有问题。问题只发生在他的 lumia 1520 上(我认为其他具有该分辨率的手机也有,但我无法测试)。当用户点击它并进入完整模式显示以选择项目时,listpicker 崩溃。这是堆栈跟踪:

Frame Image Function Offset
0 system_windows_ni MS.Internal.XcpImports.CheckHResult 0x0019fe24 
1 system_windows_ni MS.Internal.XcpImports.SetValue 0x00000056 
2 system_windows_ni MS.Internal.XcpImports.SetValue 0x000004e4 
3 system_windows_ni System.Windows.DependencyObject.SetObjectValueToCore 0x0000006c 
4 system_windows_ni System.Windows.DependencyObject.SetEffectiveValue 0x0000002e 
5 system_windows_ni System.Windows.DependencyObject.UpdateEffectiveValue 0x00000086 
6 system_windows_ni System.Windows.DependencyObject.SetValueInternal 0x00000112 
7 microsoft_phone_ni Microsoft.Phone.Controls.PhoneApplicationFrame.UpdateMargin 0x000001b8 
8 microsoft_phone_ni Microsoft.Phone.Controls.PhoneApplicationFrame.InternalUpdateOrientationAndMarginForPage 0x0000006c 
9 microsoft_phone_ni Microsoft.Phone.Controls.PhoneApplicationFrame.System.Windows.Controls.IFrame.InternalUpdateOrientationAndMarginForPage 0x00000020 
10 microsoft_phone_ni System.Windows.Navigation.NavigationService.CompleteNavigation 0x0000016a 
11 microsoft_phone_ni System.Windows.Navigation.NavigationService+__c__DisplayClass7._NavigateCore_StartNavigation_b__4 0x00000020

这是 listpicker 的 xaml 代码:

<toolkit:ListPicker  VerticalAlignment="Center" Grid.Column="1" Grid.Row="1" ItemsSource="{Binding Categories}" SelectedItem="{Binding Category, Mode=TwoWay}"  />

这是风格:

<Style TargetType="toolkit:ListPicker">
    <Setter Property="FullModeItemTemplate">
        <Setter.Value>
            <DataTemplate>
                    <StackPanel Orientation="Horizontal" Margin="16 15 0 15">
                    <TextBlock Text="{Binding}"
                                   Margin="0 0 0 0"
                                   FontSize="{StaticResource PhoneFontSizeLarge}" 
                                   FontFamily="{StaticResource PhoneFontFamilyLight}"/>
                </StackPanel>
            </DataTemplate>
        </Setter.Value>
    </Setter>
</Style>

这是有列表选择器的页面:

<local:MyPhoneApplicationPage 
x:Class="EasyShopping.Views.Details.ProductDetailView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:local="clr-namespace:EasyShopping.Framework"
xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"  
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d" d:DesignHeight="696" d:DesignWidth="480"
xmlns:vm="clr-namespace:EasyShopping.ViewModels.Details"
d:DataContext="{d:DesignInstance vm:SampleProductDetailViewModel, IsDesignTimeCreatable=True}"
shell:SystemTray.IsVisible="False">

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <!--TitlePanel contains the name of the application and page title-->
    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
        <TextBlock x:Name="ApplicationTitle" Text="{Binding Resources.AppNameTitle}" Style="{StaticResource PhoneTextNormalStyle}"/>
        <TextBlock x:Name="PageTitle" Text="{Binding Resources.Product}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="150" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <TextBlock  Text="{Binding Resources.Name}" HorizontalAlignment="Center" VerticalAlignment="Center"  Style="{StaticResource PhoneTextNormalStyle}"/>
        <TextBox  Grid.Column="1" Text="{Binding Name, Mode=TwoWay}" InputScope="Text" />


        <TextBlock Grid.Row="1"  Text="{Binding Resources.Category}" HorizontalAlignment="Center" VerticalAlignment="Center"  Style="{StaticResource PhoneTextNormalStyle}"/>
        <toolkit:ListPicker  VerticalAlignment="Center" Grid.Column="1" Grid.Row="1" ItemsSource="{Binding Categories}" SelectedItem="{Binding Category, Mode=TwoWay}"  />

        <TextBlock Grid.Row="2" TextWrapping="Wrap" Text="{Binding Resources.DefaultMeasureUnit}" HorizontalAlignment="Center" VerticalAlignment="Center"  Style="{StaticResource PhoneTextNormalStyle}"/>
        <toolkit:ListPicker VerticalAlignment="Center" Grid.Column="1" Grid.Row="2"  ItemsSource="{Binding QuantityTypes}" SelectedItem="{Binding QtaType, Mode=TwoWay}" />
    </Grid>
</Grid>

<local:MyPhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
        <cal:AppBarButton IconUri="/Images/save.png" Text="save" Message="Save" />
        <cal:AppBarButton IconUri="/Images/cancel.png" Text="cancel" Message="Cancel" />
    </shell:ApplicationBar>
</local:MyPhoneApplicationPage.ApplicationBar>
<toolkit:TransitionService.NavigationInTransition>
    <toolkit:NavigationInTransition>
        <toolkit:NavigationInTransition.Backward>
            <toolkit:TurnstileTransition Mode="BackwardIn"/>
        </toolkit:NavigationInTransition.Backward>
        <toolkit:NavigationInTransition.Forward>
            <toolkit:TurnstileTransition Mode="ForwardIn"/>
        </toolkit:NavigationInTransition.Forward>
    </toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
<toolkit:TransitionService.NavigationOutTransition>
    <toolkit:NavigationOutTransition>
        <toolkit:NavigationOutTransition.Backward>
            <toolkit:TurnstileTransition Mode="BackwardOut"/>
        </toolkit:NavigationOutTransition.Backward>
        <toolkit:NavigationOutTransition.Forward>
            <toolkit:TurnstileTransition Mode="ForwardOut"/>
        </toolkit:NavigationOutTransition.Forward>
    </toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>

有人可以帮助我吗?

谢谢卢卡

4

0 回答 0