滚动查看器中的网格内存不足异常

时间:2016-09-28 14:58:16

标签: c# silverlight memory grid

我非常擅长使用C#为WP 8.1 Silverlight开发应用程序。 我开发了一个应用程序来显示来自csv文件的数据。 数据显示在具有7列的scrollviewer元素内的网格中。 一切正常。但是当应用程序从csv文件获得超过600行时,应用程序崩溃并出现内存不足异常。 我怎么能避免这个?在网格中显示600行文本应该没有问题。

请参阅我的代码:

//insert lines:
//Row create:   

reihe1 = new RowDefinition();
reihe1.Height = new GridLength(zeilenhoehe);
grid_umsatzdetail.RowDefinitions.Add(reihe1);
reihe1 = null;

//Columns create:
//first column date:
textblock_name = dateizeile + "|" + index_daten + "|" + "0";
TextBlock textblock_new_datum = new TextBlock();
textblock_new_datum.Name = textblock_name; 
textblock_new_datum.Height = zeilenhoehe;
textblock_new_datum.Width = Double.NaN;
textblock_new_datum.FontSize = schriftgroesse;
textblock_new_datum.Text = " " + teile[0] + " ";

Grid.SetRow(textblock_new_datum, zaehler_reihe);
Grid.SetColumn(textblock_new_datum, 0);
grid_umsatzdetail.Children.Add(textblock_new_datum);
textblock_new_datum = null;

//border insert into grid:
rand = new Border();
rand.BorderThickness = new Thickness(1);
rand.BorderBrush = new SolidColorBrush(Colors.White);
rand.Width = Double.NaN;
rand.Height = zeilenhoehe_head;
Grid.SetRow(rand, zaehler_reihe);
Grid.SetColumn(rand, 0);
grid_umsatzdetail.Children.Add(rand);
rand = null;

//second column amount:
... same coding as above for every column ...

我真的很高兴任何提示!

0 个答案:

没有答案