Handle ComboCheckBoxes in AdministrationWindow
This commit is contained in:
@ -65,31 +65,31 @@ namespace Elwig.Helpers {
|
||||
return client;
|
||||
}
|
||||
|
||||
public static void SetInputChanged(Control input) {
|
||||
var brush = Brushes.Orange;
|
||||
private static void SetControlBrush(Control input, Brush brush) {
|
||||
if (input is ComboBox cb) {
|
||||
var border = GetComboBoxBorder(cb);
|
||||
if (border != null)
|
||||
border.BorderBrush = brush;
|
||||
if (border != null) border.BorderBrush = brush;
|
||||
} else if (input is Xceed.Wpf.Toolkit.CheckComboBox ccb) {
|
||||
var border = GetComboBoxBorder(ccb);
|
||||
if (border != null) border.BorderBrush = brush;
|
||||
} else {
|
||||
input.BorderBrush = brush;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetInputChanged(Control input) {
|
||||
SetControlBrush(input, Brushes.Orange);
|
||||
}
|
||||
|
||||
public static void SetInputInvalid(Control input) {
|
||||
var brush = Brushes.Red;
|
||||
if (input is ComboBox cb) {
|
||||
var border = GetComboBoxBorder(cb);
|
||||
if (border != null)
|
||||
border.BorderBrush = brush;
|
||||
} else {
|
||||
input.BorderBrush = brush;
|
||||
}
|
||||
SetControlBrush(input, Brushes.Red);
|
||||
}
|
||||
|
||||
public static void ClearInputState(Control input) {
|
||||
if (input is ComboBox cb) {
|
||||
GetComboBoxBorder(cb)?.ClearValue(Border.BorderBrushProperty);
|
||||
} else if (input is Xceed.Wpf.Toolkit.CheckComboBox ccb) {
|
||||
GetComboBoxBorder(ccb)?.ClearValue(Border.BorderBrushProperty);
|
||||
} else {
|
||||
input.ClearValue(Control.BorderBrushProperty);
|
||||
}
|
||||
@ -100,6 +100,11 @@ namespace Elwig.Helpers {
|
||||
return toggleButton?.Template.FindName("templateRoot", toggleButton) as Border;
|
||||
}
|
||||
|
||||
private static Border? GetComboBoxBorder(Xceed.Wpf.Toolkit.CheckComboBox ccb) {
|
||||
var toggleButton = ccb.Template.FindName("toggleButton", ccb) as ToggleButton;
|
||||
return toggleButton?.Template.FindName("templateRoot", toggleButton) as Border;
|
||||
}
|
||||
|
||||
public static IEnumerable<T> FindAllChildren<T>(DependencyObject depObj) where T : DependencyObject {
|
||||
if (depObj == null)
|
||||
yield return (T)Enumerable.Empty<T>();
|
||||
|
Reference in New Issue
Block a user