日期:2014-05-17 浏览次数:20826 次
using Windows.Storage;
using System.Xml.Linq;
using System.IO;
public sealed class SampleDataSource
{
private IEnumerable<XElement> _els;
public async void setgroupedItemsViewSource()
{
var picturesLibrary = Windows.Storage.KnownFolders.PicturesLibrary;
Windows.Storage.StorageFile file = await picturesLibrary.GetFileAsync(@"file.xml");
XDocument doc1 = new XDocument();
using (Stream stream = await file.OpenStreamForReadAsync())
{
doc1 = XDocument.Load(stream);
}
var els = from el in doc1.Root.Elements()
select el;
this._els = els;
}
public SampleDataSource()
{
setgroupedItemsViewSource();
foreach (XElement el in this._els)
{
group1.Items.Add(new SampleDataItem((string)el.Attribute("id"));
}
}
}