windows-phone-7 – 为什么我从LongListSelector下载时收到“格式严格限制:唯一属性规范”(0xc00cee3c)错误

我试图从Silverlight工具包LongListSelector创建一个后代类.我们称之为SimpleLonglistSelector.我从“Silverlight for Windows Phone Toolkit Source& Sample – Feb 2011.zip”开始.

http://silverlight.codeplex.com/releases/view/60291

我创建了一个新课程:

public class SimpleLongListSelector : LongListSelector
{
    public SimpleLongListSelector()
    {
        var itemsPanelTemplate = @"
            <ItemsPanelTemplate xmlns='http://schemas.microsoft.com/client/2007'>
                <toolkit:WrapPanel xmlns:toolkit='clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit' Orientation=""Horizontal""/>
            </ItemsPanelTemplate>";

        this.GroupItemsPanel = (ItemsPanelTemplate)XamlReader.Load(itemsPanelTemplate);

        var groupItemTemplate = @"
            <DataTemplate xmlns='http://schemas.microsoft.com/client/2007'>
                <Border Width=""99"" Height=""99"" Background=""{StaticResource PhoneAccentBrush}"" Margin=""6"" IsHitTestVisible=""{Binding HasItems}"">
                    <TextBlock Text=""{Binding Key}"" 
                                           FontFamily=""{StaticResource PhoneFontFamilySemiBold}""
                                           FontSize=""36""
                                           Margin=""{StaticResource PhonetouchTargetoverhang}""
                                           Foreground=""{StaticResource PhoneForegroundBrush}""                                        
                                           VerticalAlignment=""Bottom""/>
                </Border>
            </DataTemplate>";

        this.GroupItemTemplate = (DataTemplate)XamlReader.Load(groupItemTemplate);

        var groupHeaderTemplate = @"
            <DataTemplate xmlns='http://schemas.microsoft.com/client/2007'>
                <Border Background=""Transparent"">
                    <Border Background=""{StaticResource PhoneAccentBrush}"" Width=""75"" Height=""75"" HorizontalAlignment=""Left"">
                        <TextBlock Text=""{Binding Path=Key}"" 
                                               Foreground=""{StaticResource PhoneForegroundBrush}"" 
                                               Style=""{StaticResource PhoneTextExtraLargeStyle}""
                                               VerticalAlignment=""Bottom""/>
                    </Border>
                </Border>
            </DataTemplate>";

        this.GroupHeaderTemplate = (DataTemplate)XamlReader.Load(groupHeaderTemplate);

        var itemTemplate = @"
            <DataTemplate xmlns='http://schemas.microsoft.com/client/2007'>
                <TextBlock Text=""{Binding Title}"" FontSize=""30""/>
            </DataTemplate>";

        this.ItemTemplate = (DataTemplate)XamlReader.Load(itemTemplate);
    }
}

然后我将它添加到LongListSelector示例中,与所有其他长列表选择器的枢轴相同:

<controls:PivotItem Header="sllS">
                <local:SimpleLongListSelector x:Name="simple" />
            </controls:PivotItem>

然后我把它的来源与LoadLinqMovies()中的电影源相同,

simple.ItemsSource = moviesByCategory;

然后运行代码(我知道它看起来不漂亮,这是因为绑定没有设置正确,我这样做,所以你知道这不是数据,如果你愿意,你可以这样做:

simple.ItemsSource = movies.GroupBy((m) => m.Title[0]).Select((c) => new PublicGrouping<char,Movie>(c));

看起来我想要看它.

那么,无论哪种情况,这都是按预期的方式工作,除非我点击组头. (任何[认蓝色]方块).我得到了

WrappedException

错误信息是:

0xc00cee3c

我认为是什么意思:

well-formedness constraint: unique attribute spec

我不认为我有一个唯一性的问题.我究竟做错了什么?

如果您使用7.1工具包中的LongListSelector,可以在 http://silverlight.codeplex.com/releases/view/71550找到,您的示例代码如上所列.这一定是原来LLS中的一些bug

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...