我正在尝试将第二个BindingList添加到ListBox但无法弄清楚如何。这是我的代码。
private Entitycontext context = new Entitycontext();
private BindingList<TblProduct> products = new BindingList<TblProduct>();
private BindingList <TblProductItem> SubProduct = new BindingList <TblProductItem>();
public form1()
{
InitializeComponent();
// here in listbox i want to add the second BindingList but I don't Know how??
// Could some One help me with this please..
ListBox.DataSource = Products;
}
/// here the listbox is format as FormaLIstItem
private void FormaLIstItem(object sender, ListControlConvertEventArgs e)
{
string currentDescription = ((TblProduct)e.ListItem).Description.PadRight(25);
string currentPrice = string.Format("{0:C}"((TblProduct)e.ListItem).Price).PadRight(25);
e.Value = currentDescription + currentPrice;
string currentDescriptions = ((TblProductItem)e.Value).Description.PadRight(25);
string currentPrices = string.Format("{0:C}",((TblProductItem)e.Value).Price).PadRight(25);
e.Value = currentDescriptions + currentPrices;
}