Fix CheckComboBox border color
This commit is contained in:
@ -10,13 +10,16 @@ using System.Windows.Media;
|
||||
namespace Elwig.Helpers {
|
||||
public class ControlUtils {
|
||||
|
||||
public enum RenewSourceDefault {
|
||||
None,
|
||||
IfOnly,
|
||||
First
|
||||
}
|
||||
|
||||
private static void SetControlBrush(Control input, Brush brush) {
|
||||
if (input is ComboBox cb) {
|
||||
var border = GetComboBoxBorder(cb);
|
||||
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;
|
||||
}
|
||||
@ -33,8 +36,6 @@ namespace Elwig.Helpers {
|
||||
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);
|
||||
}
|
||||
@ -45,11 +46,6 @@ 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>();
|
||||
@ -82,12 +78,6 @@ namespace Elwig.Helpers {
|
||||
return null;
|
||||
}
|
||||
|
||||
public enum RenewSourceDefault {
|
||||
None,
|
||||
IfOnly,
|
||||
First
|
||||
}
|
||||
|
||||
public static void RenewItemsSource(Selector selector, IEnumerable? source, Func<object?, object?> getId, SelectionChangedEventHandler? handler = null, RenewSourceDefault def = RenewSourceDefault.None) {
|
||||
if (selector.ItemsSource == source)
|
||||
return;
|
||||
|
Reference in New Issue
Block a user