2016-06-15 50 views
-1

我正在修復一些使我的生活變得困難的舊代碼。以下是組合框中填充的列表的代碼。目前它沒有排序,我想對它進行排序。但是,我嘗試過的所有方法都不起作用:在C中排序ListItem#

foreach (InteractiveInfo template in MySource) 
{ 
     Product product = FindProduct(template.MyProductId); 
     if (product != null) 
     { 
      ddlProducts.Items.Add(
      new ListItem(
       string.Format("{0} ({1})", product.Dscrp, product.MyProductId), 
        template.MyProductId.ToString(CultureInfo.InvariantCulture))); 

     } 
} 

我想按照Dscrp對其進行排序。

回答

-3

您可以使用SortDescriptions對WPF列表進行排序

+1

asp.net不是WPF – ryanyuyu