AdministrationWindow: Fix LostFocus Focus issue

This commit is contained in:
2023-08-30 14:24:45 +02:00
parent 9b84452b86
commit 1f377483a5

View File

@ -149,10 +149,8 @@ namespace Elwig.Windows {
}
protected void LockInputs() {
foreach (var tb in TextBoxInputs) {
foreach (var tb in TextBoxInputs)
tb.IsReadOnly = true;
tb.Focusable = false;
}
foreach (var cb in ComboBoxInputs)
cb.IsEnabled = false;
foreach (var ccb in CheckComboBoxInputs)
@ -164,10 +162,8 @@ namespace Elwig.Windows {
}
protected void UnlockInputs() {
foreach (var tb in TextBoxInputs) {
foreach (var tb in TextBoxInputs)
tb.IsReadOnly = false;
tb.Focusable = true;
}
foreach (var cb in ComboBoxInputs)
cb.IsEnabled = true;
foreach (var ccb in CheckComboBoxInputs)
@ -359,7 +355,7 @@ namespace Elwig.Windows {
}
protected bool InputLostFocus(TextBox input, ValidationResult res, string? msg = null) {
if (!res.IsValid && !IsClosing)
if (!res.IsValid && !IsClosing && (IsEditing || IsCreating))
System.Windows.MessageBox.Show(res.ErrorContent.ToString(), msg ?? res.ErrorContent.ToString(), MessageBoxButton.OK, MessageBoxImage.Warning);
return res.IsValid;
}