Windows phone 7 如何将amq:SerialChart的数据源绑定到隔离存储中的文件名
我需要用amq:SerialChart的数据源绑定隔离存储中某些特定文件的名称和创建日期。(windows phone 7.8) 我试着为它制作一个视图模型Windows phone 7 如何将amq:SerialChart的数据源绑定到隔离存储中的文件名,windows-phone-7,data-binding,charts,isolatedstorage,Windows Phone 7,Data Binding,Charts,Isolatedstorage,我需要用amq:SerialChart的数据源绑定隔离存储中某些特定文件的名称和创建日期。(windows phone 7.8) 我试着为它制作一个视图模型 public class MainViewModel { public MainViewModel() { var appStorage = IsolatedStorageFile.GetUserStoreForApplication(); var items = new List&
public class MainViewModel
{
public MainViewModel()
{
var appStorage = IsolatedStorageFile.GetUserStoreForApplication();
var items = new List<ChartItemViewModel>();
string[] fileName = appStorage.GetFileNames("issue*");
foreach( string file in fileName)
{
items.Add(new ChartItemViewModel { Month =file, Value=appStorage.GetCreationTime(file).ToString()});
}
var chart = new ChartViewModel { Items = items };
this.Charts = Enumerable.Repeat(0, 5).Select(_ => chart).ToList();
}
public List<ChartViewModel> Charts { get; set; }
}
}
public类主视图模型
{
公共主视图模型()
{
var appStorage=IsolatedStorageFile.GetUserStoreForApplication();
var items=新列表();
string[]fileName=appStorage.getfilename(“问题*”);
foreach(文件名中的字符串文件)
{
添加(新的ChartItemViewModel{Month=file,Value=appStorage.GetCreationTime(file.ToString()});
}
var chart=new ChartViewModel{Items=Items};
this.Charts=Enumerable.Repeat(0,5)。选择(=>chart.ToList();
}
公共列表图表{get;set;}
}
}
但当我运行这个时,我得到了异常。同样的xaml代码是
<controls:PivotItem Header="Line">
<amq:SerialChart Style="{StaticResource chartStyle}"
DataSource="{Binding Charts[0].Items}"
CategoryValueMemberPath="Month">
<amq:SerialChart.Graphs>
<amq:LineGraph ValueMemberPath="Value" Title="Test Chart" />
</amq:SerialChart.Graphs>
</amq:SerialChart>
</controls:PivotItem>