Select plz if only one
This commit is contained in:
@ -150,6 +150,8 @@ namespace Elwig.Windows {
|
|||||||
var list = plzInputValid && plzInput.Text.Length == 4 ? Context.Postleitzahlen.Find(int.Parse(plzInput.Text))?.Orte.ToList() : null;
|
var list = plzInputValid && plzInput.Text.Length == 4 ? Context.Postleitzahlen.Find(int.Parse(plzInput.Text))?.Orte.ToList() : null;
|
||||||
ortInput.ItemsSource = list;
|
ortInput.ItemsSource = list;
|
||||||
ortInput.SelectedItem = (list != null && item != null && list.Contains(item)) ? item : null;
|
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());
|
ComboBox_SelectionChanged(ortInput, new());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user