Select plz if only one

This commit is contained in:
2023-04-28 00:33:21 +02:00
parent 77781d227c
commit 4456b2228d

View File

@ -150,6 +150,8 @@ namespace Elwig.Windows {
var list = plzInputValid && plzInput.Text.Length == 4 ? Context.Postleitzahlen.Find(int.Parse(plzInput.Text))?.Orte.ToList() : null;
ortInput.ItemsSource = list;
ortInput.SelectedItem = (list != null && item != null && list.Contains(item)) ? item : null;
if (list != null && ortInput.SelectedItem == null && list.Count == 1)
ortInput.SelectedItem = list[0];
ComboBox_SelectionChanged(ortInput, new());
}