ControlUtils: small fixes

This commit is contained in:
2023-11-16 09:42:47 +01:00
parent df5007826d
commit e962d1e44b

View File

@ -5,7 +5,8 @@ using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Controls.Primitives; using System.Windows.Controls.Primitives;
using System.Windows.Media; using Brush = System.Windows.Media.Brush;
using Brushes = System.Windows.Media.Brushes;
namespace Elwig.Helpers { namespace Elwig.Helpers {
public class ControlUtils { public class ControlUtils {
@ -16,7 +17,7 @@ namespace Elwig.Helpers {
First First
} }
private static void SetControlBrush(Control input, Brush brush) { private static void SetControlBorderBrush(Control input, Brush brush) {
if (input is ComboBox cb) { if (input is ComboBox cb) {
var border = GetComboBoxBorder(cb); var border = GetComboBoxBorder(cb);
if (border != null) border.BorderBrush = brush; if (border != null) border.BorderBrush = brush;
@ -26,15 +27,15 @@ namespace Elwig.Helpers {
} }
public static void SetInputNotDefault(Control input) { public static void SetInputNotDefault(Control input) {
SetControlBrush(input, Brushes.Gold); SetControlBorderBrush(input, Brushes.Gold);
} }
public static void SetInputChanged(Control input) { public static void SetInputChanged(Control input) {
SetControlBrush(input, Brushes.Orange); SetControlBorderBrush(input, Brushes.Orange);
} }
public static void SetInputInvalid(Control input) { public static void SetInputInvalid(Control input) {
SetControlBrush(input, Brushes.Red); SetControlBorderBrush(input, Brushes.Red);
} }
public static void ClearInputState(Control input) { public static void ClearInputState(Control input) {