![](/img/trans.png)
[英]Binding AutocompleteBox in WP7 Application from an ObservableCollection<>, created by a Local Database
[英]wp7 ObservableCollection population
我正在使用AMCharts控件,但我尝试按照该示例进行操作,但是我不确定如何将我的historyItemCollection(图1)中的数据获取到Observable集合(图2)中?
图。1:
from item in App.ViewModel.historyItemCollection
where item.VehicleId == (Application.Current as App).vehicleId
select item;
图2:
private ObservableCollection<TestDataItem> _data = new ObservableCollection<TestDataItem>()
{
new TestDataItem() { axis = "Mar", value=5},
new TestDataItem() { axis = "Apr", value=15.2},
new TestDataItem() { axis = "May", value=25},
new TestDataItem() { axis = "June", value=8.1},
};
在historyitemcollection中,我有一个要放入轴值的日期项以及一个要放入值值的成本项(图2 :)
如何将数据放入observableCollection中,以便可以使用此图表控件?
_data = new ObservableCollection<HistoryItem>
(
from item in App.ViewModel.historyItemCollection
where item.VehicleId == (Application.Current as App).vehicleId
select item;
)
或者在运行时
var historyItems =
from item in App.ViewModel.historyItemCollection
where item.VehicleId == (Application.Current as App).vehicleId
select item;
foreach (var item in historyItems)
_data.Add(item);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.