Recently I need to loop through a Generic list and bind the result to a Combobox. Here is how you can do this in C#
List<CCDSDateResult> list = new List<CCDSDateResult>();for (int i = 0; i < e.Result.Count; i++){if (e.Result.ToList()[i].ccds_date.ToString().Length > 0){// Write your logic..to add item in the listlist.Add(new CCDSDateResult(DateTime.Parse(e.Result.ToList()[i].ccds_date.ToString())));}}// adding a empty record to the listlist.Insert(0, new CCDSDateResult());this.OrderComboBox.ItemsSource = list.ToList();
Hope this is useful.
No comments:
Post a Comment