using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using HandyControl.Controls; using HandyControl.Data; namespace HandyControl.Tools { public class ButtonGroupItemStyleSelector : StyleSelector { public override Style SelectStyle(object item, DependencyObject container) { if (container is ButtonGroup buttonGroup && item is ButtonBase buttonBase) { var count = buttonGroup.Items.Count; switch (buttonBase) { case RadioButton _: { if (count == 1) { return ResourceHelper.GetResourceInternal