Skip to content

Commit

Permalink
Make it work with image combo box
Browse files Browse the repository at this point in the history
  • Loading branch information
msevestre committed Oct 28, 2020
1 parent f82d150 commit e925aee
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/OSPSuite.UI/Views/Importer/ColumnMappingControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,13 @@ public void AttachPresenter(IColumnMappingPresenter presenter)

private RepositoryItem descriptionRepository(ColumnMappingDTO model)
{
var descriptionRepository = new UxRepositoryItemComboBox(columnMappingGridView)
var descriptionRepository = new UxRepositoryItemImageComboBox(columnMappingGridView, _imageListRetriever)
{
AutoComplete = true,
AllowNullInput = DefaultBoolean.True,
CloseUpKey = new KeyShortcut(Keys.Enter)
};
// descriptionRepository.FillComboBoxRepositoryWith(_presenter.GetAvailableOptionsFor(model));
// descriptionRepository.FillImageComboBoxRepositoryWith(_presenter.GetAvailableOptionsFor(model), x => x.IconIndex);
fillComboBoxItems(descriptionRepository, _presenter.GetAvailableOptionsFor(model));
return descriptionRepository;
Expand Down Expand Up @@ -256,13 +257,16 @@ private void fillComboBoxItem(RepositoryItemImageComboBox editor, ColumnMappingO
});
}

private void fillComboBoxItems(RepositoryItemComboBox editor, IEnumerable<ColumnMappingOption> options)
private void fillComboBoxItems(RepositoryItemImageComboBox editor, IEnumerable<ColumnMappingOption> options)
{
editor.Items.Clear();
editor.NullText = Captions.Importer.NoneEditorNullText;
foreach (var option in options)
{
editor.Items.Add(new ComboBoxItem(option.Label));
editor.Items.Add(new ImageComboBoxItem(option.Description)
{
Description = option.Label,
});
}

editor.KeyDown += clearSelectionOnDeleteForComboBoxEdit;
Expand Down

0 comments on commit e925aee

Please sign in to comment.