我按照this链接绑定数据进行查看。但是我无法使用CompositeDataSource uisng MVVM显示结果。
pixelX = new double[grayScaleData.Length];
grayLevelY = new double[grayScaleData.Length];
for (int i = 0; i < grayScaleData.Length; i++)
{
pixelX[i] = i;
grayLevelY[i] = grayScaleData[i];
if (i >= (leftEdge + avgGrayoffset) && i <= (rightEdge - avgGrayoffset))
{
totalGrayScale += grayScaleData[i];
totalPixels++;
}
}
EnumerableDataSource<double> xSrc = new EnumerableDataSource<double>(pixelX);
xSrc.SetXMapping(x => x);
grayScaleDataSource = new EnumerableDataSource<double>(grayLevelY);
grayScaleDataSource.SetYMapping(y => y);
CompositeDataSource source= new CompositeDataSource(xSrc, grayScaleDataSource);
for (int i = 0; i < grayScaleData.Length; i++)
{
//here I am not able to convert a CompositeDataSource to a point source
// list.Add(new Point(??,??));
}
GrayScalePlotData = new ObservableDataSource<Point>(list);
只使用Point
我能看到一些随机情节
list.Add(new Point(pixelX[i], grayLevelY[i]));
任何人都可以建议什么是更好的方法呢?
答案 0 :(得分:0)
将CompositeDataSource
复制到绑定变量就可以了。