private void _cb_SelectedIndexChanged(object sender, EventArgs e) { if (ItemSelected == null) { return; } FileComboBoxItem item = _cb.SelectedItem as FileComboBoxItem; if (item != null) { ItemSelected(item); } }
public void Load() { try { _cb.Items.Clear(); string[] flist = Directory.GetFiles(FolderPath); SortedList <string, string> slist = new SortedList <string, string>(); foreach (string f in flist) { slist.Add(f, f); } foreach (KeyValuePair <string, string> p in slist) { FileComboBoxItem i = new FileComboBoxItem(p.Value); _cb.Items.Add(i); } } catch (Exception err) { Program.Log.Write(err); } }