AdministrationWindow: Fix default value handling

This commit is contained in:
2023-08-30 14:54:16 +02:00
parent 1f377483a5
commit 5aa8e45652
5 changed files with 52 additions and 9 deletions

View File

@ -203,5 +203,21 @@ namespace Elwig.Helpers {
public static void SelectCheckComboBoxItems(Xceed.Wpf.Toolkit.CheckComboBox ccb, IEnumerable<object>? items, Func<object?, object?> getId) {
SelectCheckComboBoxItems(ccb, getId, items?.Select(i => getId(i)));
}
public static object? GetInputValue(Control input) {
if (input is TextBox tb) {
return tb.Text;
} else if (input is ComboBox sb) {
return sb.SelectedItem;
} else if (input is Xceed.Wpf.Toolkit.CheckComboBox ccb) {
return ccb.SelectedItems.Cast<object>().ToArray();
} else if (input is CheckBox cb) {
return cb.IsChecked;
} else if (input is RadioButton rb) {
return rb.IsChecked;
} else {
return null;
}
}
}
}