主要包含三步:
private struct keyValueList { public string Key{get;set;} // key public List<string> ValueStrList{get;set;} // the string value list for the key }
List<keyValueList> gFootprintTypeSelList; // footprint type gFootprintTypeSelList = new List<keyValueList>(); //1. option1: Guest Blogging keyValueList keyValueListGuestBlogging = new keyValueList(); keyValueListGuestBlogging.Key = "Guest Blogging"; keyValueListGuestBlogging.ValueStrList = new List<string>(); //keyValueListGuestBlogging.ValueStrList.Add("Specify Footprint"); keyValueListGuestBlogging.ValueStrList.Add("Guest Blogging"); keyValueListGuestBlogging.ValueStrList.Add("Contribute"); keyValueListGuestBlogging.ValueStrList.Add("Write for us"); keyValueListGuestBlogging.ValueStrList.Add("Guest Category"); keyValueListGuestBlogging.ValueStrList.Add("Submit Content"); gFootprintTypeSelList.Add(keyValueListGuestBlogging);
cmbFootprintType.DataSource = gFootprintTypeSelList; cmbFootprintType.DisplayMember = "key";