Improve nav hover contrast and preserve hover after click

This commit is contained in:
Meik
2026-03-05 13:01:28 +01:00
parent f68f06f767
commit 0a465698a6
2 changed files with 22 additions and 6 deletions

View File

@@ -928,14 +928,27 @@ namespace C4IT_CustomerPanel
: visualHelper.FindVisualChild<FrameworkElement>(button, "ActiveIcon");
}
private SolidColorBrush GetNavigationHoverBrush()
{
if (ConfigSettings == null)
return System.Windows.Media.Brushes.Transparent;
Color hoverColor = ConfigSettings.GetButtonHoverColor(ConfigSettings.GetBackgroundColor().Color, 1.30);
return new SolidColorBrush(hoverColor);
}
public void SetMenuAktivInaktiv(object sender, bool force, bool Silent = false)
{
Button clickedButton = (Button)sender;
ShowTabContent(this.StPaMain, clickedButton);
SolidColorBrush navHoverBrush = GetNavigationHoverBrush();
if (ActiveButton != clickedButton)
{
clickedButton.Background = System.Windows.Media.Brushes.Transparent;
clickedButton.Background = clickedButton.IsMouseOver
? navHoverBrush
: System.Windows.Media.Brushes.Transparent;
FrameworkElement activeIndicator = GetActiveTabIndicator(clickedButton);
if (activeIndicator != null)
activeIndicator.Visibility = Visibility.Visible;
@@ -945,7 +958,9 @@ namespace C4IT_CustomerPanel
if (ActiveButton != null)
{
ActiveButton.Background = System.Windows.Media.Brushes.Transparent;
ActiveButton.Background = ActiveButton.IsMouseOver
? navHoverBrush
: System.Windows.Media.Brushes.Transparent;
FrameworkElement inactiveIndicator = GetActiveTabIndicator(ActiveButton);
if (inactiveIndicator != null)
inactiveIndicator.Visibility = Visibility.Hidden;
@@ -1858,8 +1873,7 @@ namespace C4IT_CustomerPanel
if (!(sender is Button bu))
return;
Color hoverColor = ConfigSettings.GetButtonHoverColor(ConfigSettings.GetBackgroundColor().Color);
bu.Background = new SolidColorBrush(hoverColor);
bu.Background = GetNavigationHoverBrush();
}
catch (Exception exp)
{