windows phone 8 LongListSelector不跳 [英] windows phone 8 LongListSelector not jumping

查看:65
本文介绍了windows phone 8 LongListSelector不跳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我试图让LongListSelector成功但不成功:

I am trying to make a LongListSelector without success:

虽然viewModel 接缝已经分组了我的list

Although viewModel seams to have groupd my list

my c#code:

my c# code:

    public class trdrList
    {
        public Int32 trdr { get; set; }
        public string code { get; set; }
        public string name { get; set; }
        public string afm { get; set; }

        public trdrList(
            Int32 _trdr, string _code, string _name, string _afm
            )
        {
            this.trdr = _trdr;
            this.code = _code;
            this.name = _name;
            this.afm = _afm;
        }
    }


                    var GroupedItems =
                    from data in _trdrList
                    orderby data.code
                    group data by data.name.Substring(0,1) into ItemsByCode
                    //group data by data.code into ItemsByCode
                    select new KeyedList<string, trdrList>(ItemsByCode);

                    var viewModel = new List<KeyedList<string, trdrList>>(GroupedItems);

                    DataContext = viewModel;

my xaml code:

my xaml code:

<phone:PhoneApplicationPage
    x:Class="winPhone.Page1"
    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:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    xmlns:ViewModels="clr-namespace:winPhone.ViewModels" >    

    <!--LayoutRoot is the root grid where all page content is placed-->
    <phone:PhoneApplicationPage.Resources>

        <phone:JumpListItemBackgroundConverter x:Key="BackgroundConverter"/>
        <phone:JumpListItemForegroundConverter x:Key="ForegroundConverter"/>

        <Style x:Key="JumpListStyle" TargetType="phone:LongListSelector">
            <Setter Property="LayoutMode" Value="List" />
            <Setter Property="Margin" Value="12,12,0,0"/>
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Border Background="{Binding Converter={StaticResource BackgroundConverter}}" 
                                Width="470" 
                                Height="70" 
                                Margin="6">
                            <TextBlock Text="{Binding Key}"
                                       Foreground="{Binding Converter={StaticResource ForegroundConverter}}"                                       
                                       FontFamily="{StaticResource PhoneFontFamilySemiBold}"
                                       FontSize="28"  
                                       Padding="2"
                                       VerticalAlignment="Bottom"/>
                        </Border>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <DataTemplate x:Key="GroupHeader">
            <Border Background="Transparent">
                <Border Background="Transparent" BorderBrush="Transparent" BorderThickness="1"	
                        Width="400" Height="90" 				 
                        HorizontalAlignment="Left">
                    <TextBlock Text="{Binding Key}" 
                               Foreground="{StaticResource PhoneAccentBrush}" 
                               FontSize="28"
                               Padding="2"                                
                               FontFamily="{StaticResource PhoneFontFamilySemiLight}"
                               HorizontalAlignment="Left"
                               VerticalAlignment="Center"/>
                </Border>
            </Border>
        </DataTemplate>

        <DataTemplate x:Key="ItemTemplate">
            <StackPanel   Margin="6,6" Background="#FF88E2A9">
                <TextBlock Text="{Binding Content}" Foreground="Black" FontSize="25"/>
                <Rectangle Fill="Red"/>
            </StackPanel>
        </DataTemplate>

    </phone:PhoneApplicationPage.Resources>

    <Grid x:Name="LayoutRoot" Background="#FF9CE6AC">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <!--<StackPanel Grid.Row="0"  Background="#FF21C35C">-->
        <TextBlock HorizontalAlignment="Center" Text="Scrollable List items With Fixed Header" VerticalAlignment="Center" FontSize="25" Foreground="#FF4712B9" />
        <Rectangle Grid.Row="1" Margin="0,10,0,0" Height="3" Fill="Black"/>
        <!--</StackPanel>-->
        <phone:LongListSelector Grid.Row="2" BorderThickness="2" BorderBrush="Blue"
                                        ItemsSource="{Binding GroupedItems}"
                                        ItemTemplate="{StaticResource ItemTemplate}"                     
                                        GroupHeaderTemplate="{StaticResource GroupHeader}"
                                        JumpListStyle="{StaticResource JumpListStyle}" 
                                        IsGroupingEnabled="True"
                                        LayoutMode="List" 
                                        GridCellSize="108,108"/>


    </Grid>

</phone:PhoneApplicationPage>

推荐答案

你面临的问题是什么?

What is the problem you are facing?

你能发一个简单的复制品吗?您在OneDrive上的问题以及如何重现您所看到的问题的说明?

Can you post a simple repro of your problem on OneDrive and instructions on how to reproduce the problem you are seeing?


这篇关于windows phone 8 LongListSelector不跳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆