public ChartValues<ObservablePoint> Series1 { get; set; }
public void GeneratePlot(PlotInfo plotInfo)
{
DataContext = null;
Series1 = new ChartValues<ObservablePoint>();
Series1.AddRange(plotInfo.SeriesIn);
DataContext = this;
}
如何添加第一点并等待200ms并顺利添加下一个点?
现在程序的UI停止几秒钟,并显示所有点。
试试这个:
public async void GeneratePlot(PlotInfo plotInfo)
{
Series1 = new ChartValues<ObservablePoint>();
DataContext = this;
foreach (var x in plotInfo.SeriesIn)
{
Series1.Add(x);
await Task.Delay(200);
}
}