我有一个Panorama页面,其中的Feed列表来自上一页,其中包含一些图像。因此,如果该列表的大小增加,则会抛出内存异常。我的Pivot也在模板中,所以我甚至无法对图像进行处置操作。请帮忙。长期坚持这个问题。
Constants.messageDiscArray,我在上一页中设置为Constants文件。而且全景在模板中,所以我也无法对垃圾收集的图像执行任何功能。 任何帮助将不胜感激。
这是我的xaml代码:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,0,0">
<controls:Panorama x:Name="FeedsPanorama" Title="Dashboard Column" ItemsSource="{Binding Constants.messageDiscArray}" >
<controls:Panorama.ItemTemplate>
<DataTemplate>
<Grid Margin="0,-300,0,0">
<Grid Margin="0,0,0,0">
<Image Height="30" HorizontalAlignment="Left" Margin="15,319,0,0" Name="image11" Stretch="Fill" VerticalAlignment="Top" Width="30" Source="/WpControlsExample;component/Images/assigns.png" />
<Image Height="30" HorizontalAlignment="Left" Margin="340,319,0,0" Name="image13" Stretch="Fill" VerticalAlignment="Top" Width="30" Source="{Binding spamURL}" />
<Image Height="30" HorizontalAlignment="Left" Margin="376,319,0,0" Name="image14" Stretch="Fill" VerticalAlignment="Top" Width="30" Source="{Binding sentimentURL}" />
</Grid>
</Grid>
</DataTemplate>
</controls:Panorama.ItemTemplate>
</controls:Panorama>
</Grid>
</Grid>
以下是我的C#代码
public partial class MessageDescription : PhoneApplicationPage
{
private ObservableCollection<InboxItem> msArray = new ObservableCollection<InboxItem>();
public MessageDescription()
{
InitializeComponent();
loadPanoramaFeeds();
}
private void loadPanoramaFeeds()
{
for(int i=0;i< Constants.messageDiscArray.Count;i++){
msArray.Add(Constants.messageDiscArray[i]);
}
this.FeedsPanorama.ItemsSource = msArray;
this.FeedsPanorama.DefaultItem = this.FeedsPanorama.Items[Constants.messageIndex];
}
}