Refine nav state visuals with active icon highlight

This commit is contained in:
Meik
2026-03-05 11:32:05 +01:00
parent 9e4dab398f
commit a2ea0ca204
2 changed files with 146 additions and 68 deletions

View File

@@ -907,6 +907,13 @@ namespace C4IT_CustomerPanel
: visualHelper.FindVisualChild<FrameworkElement>(button, "ActiveIndicator");
}
private FrameworkElement GetActiveTabIcon(Button button)
{
return button == null
? null
: visualHelper.FindVisualChild<FrameworkElement>(button, "ActiveIcon");
}
public void SetMenuAktivInaktiv(object sender, bool force, bool Silent = false)
{
Button clickedButton = (Button)sender;
@@ -914,22 +921,23 @@ namespace C4IT_CustomerPanel
if (ActiveButton != clickedButton)
{
SolidColorBrush btnColor1 = this.ConfigSettings.GetActiveButtonColor();
if (btnColor1 != null)
{
clickedButton.Background = btnColor1;
clickedButton.Background = Brushes.Transparent;
FrameworkElement activeIndicator = GetActiveTabIndicator(clickedButton);
if (activeIndicator != null)
activeIndicator.Visibility = Visibility.Visible;
FrameworkElement activeIcon = GetActiveTabIcon(clickedButton);
if (activeIcon != null)
activeIcon.Visibility = Visibility.Visible;
FrameworkElement activeIndicator = GetActiveTabIndicator(clickedButton);
if (activeIndicator != null)
activeIndicator.Visibility = Visibility.Visible;
}
SolidColorBrush btnColor2 = this.ConfigSettings.GetInactiveButtonColor();
if (btnColor2 != null && ActiveButton != null)
if (ActiveButton != null)
{
ActiveButton.Background = btnColor2;
ActiveButton.Background = Brushes.Transparent;
FrameworkElement inactiveIndicator = GetActiveTabIndicator(ActiveButton);
if (inactiveIndicator != null)
inactiveIndicator.Visibility = Visibility.Hidden;
FrameworkElement inactiveIcon = GetActiveTabIcon(ActiveButton);
if (inactiveIcon != null)
inactiveIcon.Visibility = Visibility.Hidden;
}
ActiveButton = clickedButton;
}
@@ -1716,15 +1724,7 @@ namespace C4IT_CustomerPanel
if (!(sender is Button bu))
return;
SolidColorBrush Col;
if (!Equals(ActiveButton, bu))
Col = ConfigSettings.GetInactiveButtonColor();
else
Col = ConfigSettings.GetActiveButtonColor();
var convertFromString = Col;
if (convertFromString != null)
bu.Background = Col;
bu.Background = Brushes.Transparent;
}
catch (Exception exp)
{
@@ -1782,6 +1782,9 @@ namespace C4IT_CustomerPanel
FrameworkElement activeIndicator = GetActiveTabIndicator(bu);
if (activeIndicator != null)
activeIndicator.Visibility = Visibility.Visible;
FrameworkElement activeIcon = GetActiveTabIcon(bu);
if (activeIcon != null)
activeIcon.Visibility = Visibility.Visible;
}
catch (Exception E)
{