GridView源C#XAML中未处理的XAML UI异常/参数不正确

GridView源C#XAML中未处理的XAML UI异常/参数不正确,c#,gridview,win-universal-app,observablecollection,uwp-xaml,C#,Gridview,Win Universal App,Observablecollection,Uwp Xaml,我的应用程序更新了10个月,我遇到了一个问题。它在Windows8/8.1中运行,虽然我想我可能也已经实现了,但Windows8没有崩溃。基本上,我有从网上获取的数据,当我看这些数据时,一切似乎都是正确的。唯一的一点是,我有一个可观察的集合,其中我定义了参数/变量(由于我在应用程序中对两个不同的部分使用相同的gridview,有时我会将某些字段设置为null,因为它们没有被使用。) 这是我的基础课 public class sTumblrblog_gv : INotifyPropertyChan

我的应用程序更新了10个月,我遇到了一个问题。它在Windows8/8.1中运行,虽然我想我可能也已经实现了,但Windows8没有崩溃。基本上,我有从网上获取的数据,当我看这些数据时,一切似乎都是正确的。唯一的一点是,我有一个可观察的集合,其中我定义了参数/变量(由于我在应用程序中对两个不同的部分使用相同的gridview,有时我会将某些字段设置为null,因为它们没有被使用。)

这是我的基础课

public class sTumblrblog_gv : INotifyPropertyChanged
    {
        private string title;
        public string Title
        {
            get
            {
                return title;
            }
            set
            {
                title = value;
                NotifyPropertyChanged();
            }
        }
        private string url;
        public string Url
        {
            get
            {
                return url;
            }
            set
            {
                url = value;
                NotifyPropertyChanged();
            }
        }
        private string avatarimage;
        public string AvatarImage
        {
            get
            {
                return avatarimage;
            }
            set
            {
                avatarimage = value;
                NotifyPropertyChanged();
            }
        }

        private string blogposts;
        public string BlogPosts
        {
            get
            {
                return blogposts;
            }
            set
            {
                blogposts = value;
                NotifyPropertyChanged();
            }
        }

        private bool isnsfw;
        public bool IsNsfw
        {
            get
            {
                return isnsfw;
            }
            set
            {
                isnsfw = value;
                NotifyPropertyChanged();
            }
        }

        private BitmapImage dlimage;
        public BitmapImage DLImage
        {
            get
            {
                return dlimage;
            }
            set
            {
                dlimage = value;
                NotifyPropertyChanged();
            }
        }

        public string ImgName { get; set; }

        public sTumblrblog_gv()
        {
            //string Title;
            //string Url;
            //string AvatarImage;
            //string BlogPosts;
            //bool IsNsfw;
        }

 
        public sTumblrblog_gv(IRandomAccessStream stream, string imgname)
        {
            BitmapImage bmp = new BitmapImage();
            bmp.SetSource(stream);
            DLImage = bmp;
            ImgName = imgname;
        }

        public event PropertyChangedEventHandler PropertyChanged;

        // This method is called by the Set accessor of each property. 
        // The CallerMemberName attribute that is applied to the optional propertyName 
        // parameter causes the property name of the caller to be substituted as an argument. 
        private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
我使用此选项创建集合:

ObservableCollection<sTumblrblog_gv> sTumblrblog_gv_list = newObservableCollection<sTumblrblog_gv>();
在我添加之后它就崩溃了,除了作为{Windows.UI.Xaml.UnhandledExceptionEventArgs}-

本机视图0x0ea7ea20{…}IUnknown* {Windows.UI.Xaml.dll!ctl::ComObject}
[0]0x52b58210 {Windows.UI.Xaml.dll!ctl::ComObject::QueryInterface(常量) _GUID&,void**)}void*

在玩了几天之后,这让我相信我作为来源发送的数据中有一些东西

但我在将数据发送到可观察集合之前列举的数据与应该显示的类型和字段相匹配。(根据visual studio,我没有任何错误,包括匹配的类型等)


gridview在8和10之间是否发生了变化?

您是否找到了解决此问题的方法-我遇到了相同的问题您是否找到了解决此问题的方法-我遇到了相同的问题
    <DataTemplate x:Key="imageTemplate">
        <ItemsPanelTemplate>
            <ItemsWrapGrid Orientation="Horizontal">
                <StackPanel Orientation="Horizontal">
                    <!--        <WrapGrid Orientation="Horizontal"/>-->

                    <Border Height="100" Width="100" >
                        <Image Source="{Binding AvatarImage}" Stretch="UniformToFill" ImageFailed="Photo_ImageFailed" />
                    </Border>
                    <StackPanel Orientation="Vertical" VerticalAlignment="Top" Margin="10">
                        <Image Source="{Binding DLImage}" MaxHeight="100"  ImageFailed="Photo_ImageFailed"  />
                        <TextBlock Margin="10,0,0,0" Text="{Binding Title}" FontSize="12" />
                        <TextBlock Margin="10,2,0,0" Text="{Binding Url}" FontSize="12" />
                        <TextBlock Margin="10,2,0,0" Text="{Binding BlogPosts}" FontSize="12" />
                        <CheckBox IsChecked="{Binding IsNsfw}" x:Uid="Nsfw"  />
                        <!-- <Image Source="{Binding Path=Thumbnail,Converter={StaticResource imageConverter}}"  MaxHeight="100" />-->
                    </StackPanel>
                </StackPanel>
            </ItemsWrapGrid>
        </ItemsPanelTemplate>
    </DataTemplate>
    <CollectionViewSource x:Name="sTumblrCVS"/>
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
  {
   sTumblrblog_gv_list.Add(new sTumblrblog_gv() { Title = tumblrusrfollow.Title, Url = tumblrusrfollow.Url.ToString(), AvatarImage = imageavatar.ToString(), BlogPosts = blogposts, IsNsfw = blogisnfw, DLImage = null, ImgName = "" });
});