数百のアイテムを含むListViewがあります。スクロールバーの親指でマウスを使用してアイテムをすばやく下にスクロールすると、次のエラーが発生します。
ItemsControlがそのアイテムソースと矛盾しています
これは私のlistViewです
<ListView x:Name="lv_emails"
Grid.Row="0"
Background="{x:Null}"
BorderBrush="{x:Null}"
BorderThickness="0"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectionChanged="lv_emails_SelectionChanged"
SelectionMode="Single">
コンテンツはWindow_Loadedにロードされ、スレッド化は行われません:
private void Window_Loaded(object sender, RoutedEventArgs e)
{
emails = new List<eml>();
lv_emails.ItemsSource = emails;
// get the emails of the selected folder and show them in the ListView
eml em;
foreach (string fi in Directory.GetFiles(path))
{
string[] split = fi.Split('}');//[0]path, [1]uid, [2]email, [3]date, [4]subject
string disp = split[2] + " " + split[3] + " " + split[4];
em = new eml { filePath = fi, id = split[1], emailAddress = split[2], date = split[3], subject = split[4] };
emails.Add(em);
}
}
このエラーを停止するにはどうすればよいですか。また、なぜ発生するのですか。