2017-11-10 4 views
1

私はWPFで簡単な図表フィード表示をしようとしています。私はInstagram APIから取得された画像URLのObservableCollectionにバインドされているListViewを持っています。何らかの理由で、最初の10個程度しかロードできません(もっとバインドしようとしていますが)。低解像度の画像をロードしようとすると、正常に動作するように見えます。しかし、私はとにかく大規模な画像について話しているわけではありません。ウェブからたくさんの画像を読み込むときに問題があります

ここに、instagramのハードコードされたイメージのリストを示すコード例があります。私にとっては、これは最初の10をロードしてから11を逃し、次に12をロードします。理由はわかりません。

XAML:背後

<ListView x:Name="List" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.CanContentScroll="False"> 
    <ListView.ItemsPanel> 
     <ItemsPanelTemplate> 
      <WrapPanel /> 
     </ItemsPanelTemplate> 
    </ListView.ItemsPanel> 
    <ListView.ItemTemplate> 
     <DataTemplate> 
      <Grid Width="250" Height="250" Background="Orange"> 
       <Image Margin="3" Source="{Binding}" Stretch="Uniform" VerticalAlignment="Center" /> 
      </Grid> 
     </DataTemplate> 
    </ListView.ItemTemplate> 
</ListView> 

コード:

List<string> content = new List<string>() 
{ 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23498621_155088151891201_5838888733310451712_n.jpg",  
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/e15/23421369_1935881716650536_2751759012239245312_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23498900_2424691114423634_1760461413358239744_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23498900_2424691114423634_1760461413358239744_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23347618_263128534210376_920911369891479552_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23421069_1500830839998934_8413516091602501632_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23417348_742804169243503_6556496499100876800_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23347902_2017564028488677_2880579113104441344_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23421331_334537296949861_4296430067371737088_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23421331_334537296949861_4296430067371737088_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23416590_1928818560779337_7080637368553701376_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/sh0.08/e35/p640x640/23421758_491705774540588_6178820534202007552_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23421099_1728264697245367_6448825186568372224_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23416994_133163334113394_1499431022142423040_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23421239_1483718185060885_8134914164545028096_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23280089_1942832749376286_3936575794389712896_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23347674_2006888666245374_7306582919252803584_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23347388_119626992143009_7585283007787827200_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23421865_90030116_1326331715420946432_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23421253_148762415872849_1558483017121398784_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/sh0.08/e35/p640x640/23507217_1953269574998281_6711372701967056896_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/sh0.08/e35/p640x640/23507217_1953269574998281_6711372701967056896_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23498098_2009691429314434_8349013357923139584_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/e15/23347679_315062128974030_5091325576380153856_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/sh0.08/e35/p640x640/23421083_1777350415899180_3004366087824343040_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/sh0.08/e35/p640x640/23421083_1777350415899180_3004366087824343040_n.jpg", 
    "https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/23498903_773821689486761_9202713497564086272_n.jpg" 
}; 

List.ItemsSource = content; 
+0

ObservableCollectionが完全に冗長であるようです。あなたは 'List.ItemsSource = content;'と書くこともできます。それでも必要な場合は、 'oDataCollection = new ObservableCollection (content);' – Clemens

+0

のように初期化してください。サンプルコードでは表示していません。観察可能なコレクションを削除するコードを編集しました。 – user2424495

答えて

1

あなたはあなたのアプリケーションのために同じホストへの最大接続数の制限に実行しています。あなたはこのhereについての詳細を読むことができます

<system.net> 
    <connectionManagement> 
    <add address="*" maxconnection="1000" /> 
    </connectionManagement> 
</system.net> 

:あなたは、次の下に設定を追加することができ、あなたのapp.configファイルで

、。明らかに、あなたのアプリケーションが実際に必要とするものにあなたのエントリを合わせるべきです。

+0

完璧なおかげで! – user2424495

関連する問題