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

@@ -212,7 +212,7 @@
<EventSetter Event="Loaded" <EventSetter Event="Loaded"
Handler="Button_Loaded" /> Handler="Button_Loaded" />
<Setter Property="Background" <Setter Property="Background"
Value="{DynamicResource inactiveButtonColor}" /> Value="Transparent" />
<Setter Property="Foreground" <Setter Property="Foreground"
Value="{DynamicResource navForeground}" /> Value="{DynamicResource navForeground}" />
<Setter Property="BorderBrush" <Setter Property="BorderBrush"
@@ -525,6 +525,7 @@
<Border Visibility="Hidden" <Border Visibility="Hidden"
Tag="ActiveIndicator" Tag="ActiveIndicator"
Panel.ZIndex="1001" Panel.ZIndex="1001"
Opacity="0"
Width="4" Width="4"
Height="34" Height="34"
HorizontalAlignment="Right" HorizontalAlignment="Right"
@@ -542,17 +543,31 @@
ClipToBounds="False" ClipToBounds="False"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center"> VerticalAlignment="Center">
<Image Source="{DynamicResource nav_appbar_newspaper}" <Grid Width="34"
Panel.ZIndex="18" Height="34"
Tag="ICO" Margin="14">
Style="{StaticResource ImageStyle}" <Image Source="{DynamicResource nav_appbar_newspaper}"
x:Name="icoAnn" Panel.ZIndex="18"
Stretch="Fill" Tag="ICO"
Width="34" Style="{StaticResource ImageStyle}"
Height="34" x:Name="icoAnn"
HorizontalAlignment="Center" Stretch="Fill"
VerticalAlignment="Center" Width="34"
Margin="14" /> Height="34"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
<Rectangle Tag="ActiveIcon"
Visibility="Hidden"
Panel.ZIndex="19"
Width="34"
Height="34"
Fill="{DynamicResource accentColor}">
<Rectangle.OpacityMask>
<ImageBrush ImageSource="{DynamicResource nav_appbar_newspaper}"
Stretch="Fill" />
</Rectangle.OpacityMask>
</Rectangle>
</Grid>
<Image Source="Resources/StateOverlays/OverlayNewContentButton.png" <Image Source="Resources/StateOverlays/OverlayNewContentButton.png"
Visibility="Collapsed" Visibility="Collapsed"
Panel.ZIndex="18" Panel.ZIndex="18"
@@ -585,6 +600,7 @@
<Border Visibility="Hidden" <Border Visibility="Hidden"
Tag="ActiveIndicator" Tag="ActiveIndicator"
Panel.ZIndex="1001" Panel.ZIndex="1001"
Opacity="0"
Width="4" Width="4"
Height="34" Height="34"
HorizontalAlignment="Right" HorizontalAlignment="Right"
@@ -600,15 +616,29 @@
<StackPanel x:Name="StackPanel" <StackPanel x:Name="StackPanel"
Orientation="Horizontal" Orientation="Horizontal"
Background="Transparent"> Background="Transparent">
<Image Source="{DynamicResource nav_appbar_clipboard_variant_text}" <Grid Width="34"
x:Name="icoInc" Height="34"
Tag="ICO" Margin="14">
Stretch="fill" <Image Source="{DynamicResource nav_appbar_clipboard_variant_text}"
Panel.ZIndex="18" x:Name="icoInc"
Style="{StaticResource ImageStyle}" Tag="ICO"
Width="34" Stretch="fill"
Height="34" Panel.ZIndex="18"
Margin="14" /> Style="{StaticResource ImageStyle}"
Width="34"
Height="34" />
<Rectangle Tag="ActiveIcon"
Visibility="Hidden"
Panel.ZIndex="19"
Width="34"
Height="34"
Fill="{DynamicResource accentColor}">
<Rectangle.OpacityMask>
<ImageBrush ImageSource="{DynamicResource nav_appbar_clipboard_variant_text}"
Stretch="Fill" />
</Rectangle.OpacityMask>
</Rectangle>
</Grid>
<Image Source="Resources/StateOverlays/OverlayNewContentButton.png" <Image Source="Resources/StateOverlays/OverlayNewContentButton.png"
Visibility="Collapsed" Visibility="Collapsed"
Panel.ZIndex="18" Panel.ZIndex="18"
@@ -641,6 +671,7 @@
<Border Visibility="Hidden" <Border Visibility="Hidden"
Tag="ActiveIndicator" Tag="ActiveIndicator"
Panel.ZIndex="1001" Panel.ZIndex="1001"
Opacity="0"
Width="4" Width="4"
Height="34" Height="34"
HorizontalAlignment="Right" HorizontalAlignment="Right"
@@ -655,15 +686,29 @@
</Button.Template> </Button.Template>
<StackPanel Orientation="Horizontal" <StackPanel Orientation="Horizontal"
Background="Transparent"> Background="Transparent">
<Image Source="{DynamicResource nav_appbar_cart}" <Grid Width="34"
x:Name="icoSSP" Height="34"
Stretch="fill" Margin="14">
Panel.ZIndex="18" <Image Source="{DynamicResource nav_appbar_cart}"
Style="{StaticResource ImageStyle}" x:Name="icoSSP"
Width="34" Stretch="fill"
Height="34" Panel.ZIndex="18"
Margin="14" Style="{StaticResource ImageStyle}"
Tag="ICO" /> Width="34"
Height="34"
Tag="ICO" />
<Rectangle Tag="ActiveIcon"
Visibility="Hidden"
Panel.ZIndex="19"
Width="34"
Height="34"
Fill="{DynamicResource accentColor}">
<Rectangle.OpacityMask>
<ImageBrush ImageSource="{DynamicResource nav_appbar_cart}"
Stretch="Fill" />
</Rectangle.OpacityMask>
</Rectangle>
</Grid>
<Image Source="Resources/StateOverlays/OverlayNewContentButton.png" <Image Source="Resources/StateOverlays/OverlayNewContentButton.png"
Visibility="Collapsed" Visibility="Collapsed"
Panel.ZIndex="18" Panel.ZIndex="18"
@@ -697,6 +742,7 @@
<Border Visibility="Hidden" <Border Visibility="Hidden"
Tag="ActiveIndicator" Tag="ActiveIndicator"
Panel.ZIndex="1001" Panel.ZIndex="1001"
Opacity="0"
Width="4" Width="4"
Height="34" Height="34"
HorizontalAlignment="Right" HorizontalAlignment="Right"
@@ -711,15 +757,29 @@
</Button.Template> </Button.Template>
<StackPanel Orientation="Horizontal" <StackPanel Orientation="Horizontal"
Background="Transparent"> Background="Transparent">
<Image Source="{DynamicResource nav_appbar_star}" <Grid Width="34"
x:Name="icoCustomLinks" Height="34"
Tag="ICO" Margin="14">
Stretch="fill" <Image Source="{DynamicResource nav_appbar_star}"
Panel.ZIndex="18" x:Name="icoCustomLinks"
Style="{StaticResource ImageStyle}" Tag="ICO"
Width="34" Stretch="fill"
Height="34" Panel.ZIndex="18"
Margin="14" /> Style="{StaticResource ImageStyle}"
Width="34"
Height="34" />
<Rectangle Tag="ActiveIcon"
Visibility="Hidden"
Panel.ZIndex="19"
Width="34"
Height="34"
Fill="{DynamicResource accentColor}">
<Rectangle.OpacityMask>
<ImageBrush ImageSource="{DynamicResource nav_appbar_star}"
Stretch="Fill" />
</Rectangle.OpacityMask>
</Rectangle>
</Grid>
<Image Source="Resources/StateOverlays/OverlayNewContentButton.png" <Image Source="Resources/StateOverlays/OverlayNewContentButton.png"
Visibility="Collapsed" Visibility="Collapsed"
Panel.ZIndex="18" Panel.ZIndex="18"
@@ -753,6 +813,7 @@
<Border Visibility="Hidden" <Border Visibility="Hidden"
Tag="ActiveIndicator" Tag="ActiveIndicator"
Panel.ZIndex="1001" Panel.ZIndex="1001"
Opacity="0"
Width="4" Width="4"
Height="34" Height="34"
HorizontalAlignment="Right" HorizontalAlignment="Right"
@@ -767,15 +828,29 @@
</Button.Template> </Button.Template>
<StackPanel Orientation="Horizontal" <StackPanel Orientation="Horizontal"
Background="Transparent"> Background="Transparent">
<Image Source="{DynamicResource nav_appbar_information}" <Grid Width="34"
x:Name="icoInfo" Height="34"
Tag="ICO" Margin="14">
Stretch="fill" <Image Source="{DynamicResource nav_appbar_information}"
Panel.ZIndex="18" x:Name="icoInfo"
Style="{StaticResource ImageStyle}" Tag="ICO"
Width="34" Stretch="fill"
Height="34" Panel.ZIndex="18"
Margin="14" /> Style="{StaticResource ImageStyle}"
Width="34"
Height="34" />
<Rectangle Tag="ActiveIcon"
Visibility="Hidden"
Panel.ZIndex="19"
Width="34"
Height="34"
Fill="{DynamicResource accentColor}">
<Rectangle.OpacityMask>
<ImageBrush ImageSource="{DynamicResource nav_appbar_information}"
Stretch="Fill" />
</Rectangle.OpacityMask>
</Rectangle>
</Grid>
<Image Source="Resources/StateOverlays/OverlayNewContentButton.png" <Image Source="Resources/StateOverlays/OverlayNewContentButton.png"
Visibility="Collapsed" Visibility="Collapsed"
Panel.ZIndex="18" Panel.ZIndex="18"

View File

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