1
我有大約30張圖像,我想保留爲透視控件中的項目。但是如果我所有這些都遇到了OutOfMemoryException。所以如果我超過一些限制,我想刪除數據透視表項,但如果我刪除透視選擇更改我得到InvalidException。在片段樞軸顯示中是樞軸控制。在windows phone中刪除數據透視表項
void PivotShow_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
AddItems();
}
private void AddItems()
{
PivotItem toadd = PivotGen(images[i]);
i = (i + 1) % (images.Length);
PivotShow.Items.Add(toadd);
try
{
if (PivotShow.Items.Count > 3)
PivotShow.Items.RemoveAt(0);
}
catch (InvalidOperationException)
{
MessageBox.Show("Operation not allowed");
}
}
private PivotItem PivotGen(string urlimage)
{
PivotItem p = new PivotItem();
p.Margin = new Thickness(0, -90, 0, 0);
Image img = new Image();
BitmapImage bmp = new BitmapImage(new Uri(urlimage, UriKind.Relative));
img.Stretch = Stretch.Fill;
img.Source = bmp;
p.Content = img;
return p;
//PivotShow.Items.Add(p);
}
在此先感謝