diff --git a/MainPage.xaml.cs b/MainPage.xaml.cs index 7669edc..e579eb0 100644 --- a/MainPage.xaml.cs +++ b/MainPage.xaml.cs @@ -327,6 +327,29 @@ public partial class MainPage : ContentPage, INotifyPropertyChanged CornerRadius = 0 }; + // Устанавливаем тематический цвет текста + // button.SetAppThemeColor(Button.TextColorProperty, Colors.Black, Colors.White); + + // Визуальные состояния для фокуса + var visualStateGroups = new VisualStateGroupList(); + var commonStates = new VisualStateGroup { Name = "CommonStates" }; + + var normalState = new VisualState { Name = "Normal" }; + normalState.Setters.Add(new Setter { Property = Button.BackgroundColorProperty, Value = NormalButtonColor }); + + var focusedState = new VisualState { Name = "Focused" }; + focusedState.Setters.Add(new Setter { Property = Button.BackgroundColorProperty, Value = FocusedButtonColor }); + + var pressedState = new VisualState { Name = "Pressed" }; + pressedState.Setters.Add(new Setter { Property = Button.BackgroundColorProperty, Value = NormalButtonColor }); + + commonStates.States.Add(normalState); + commonStates.States.Add(focusedState); + commonStates.States.Add(pressedState); + visualStateGroups.Add(commonStates); + + VisualStateManager.SetVisualStateGroups(button, visualStateGroups); + // Обработчик клика - выделение при клике, открытие при двойном клике button.Clicked += (s, e) => HandleItemClick(button, item, isLeft);