Improve active tab indicator with modern accent rail

This commit is contained in:
Meik
2026-03-05 10:39:35 +01:00
parent 6e40a6833f
commit 9180d88a44
2 changed files with 67 additions and 60 deletions

View File

@@ -438,16 +438,16 @@
BorderBrush="{DynamicResource navigationRailBorderColor}"
BorderThickness="1"
CornerRadius="14" />
<Canvas Panel.ZIndex="1000"
Height="62"
Width="72"
Margin="62,0,0,0">
<Polygon Visibility="Hidden"
x:Name="poly_main1"
Panel.ZIndex="900"
Points="0,0 8,0 8,62 0,62"
Fill="{Binding Background, ElementName=BtnAnnouncements}" />
</Canvas>
<Border Visibility="Hidden"
Tag="ActiveIndicator"
Panel.ZIndex="1001"
Width="4"
Height="34"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Margin="0,0,-7,0"
CornerRadius="2"
Background="{DynamicResource accentColor}" />
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Grid>
@@ -498,16 +498,16 @@
BorderBrush="{DynamicResource navigationRailBorderColor}"
BorderThickness="1"
CornerRadius="14" />
<Canvas Panel.ZIndex="1000"
Height="62"
Width="72"
Margin="62,0,0,0">
<Polygon Visibility="Hidden"
x:Name="poly_main2"
Panel.ZIndex="1000"
Points="0,0 8,0 8,62 0,62"
Fill="{Binding Background, ElementName=BtnIncident}" />
</Canvas>
<Border Visibility="Hidden"
Tag="ActiveIndicator"
Panel.ZIndex="1001"
Width="4"
Height="34"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Margin="0,0,-7,0"
CornerRadius="2"
Background="{DynamicResource accentColor}" />
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Grid>
@@ -554,16 +554,16 @@
BorderBrush="{DynamicResource navigationRailBorderColor}"
BorderThickness="1"
CornerRadius="14" />
<Canvas Panel.ZIndex="1000"
Height="62"
Width="72"
Margin="62,0,0,0">
<Polygon Visibility="Hidden"
x:Name="poly_main3"
Panel.ZIndex="1000"
Points="0,0 8,0 8,62 0,62"
Fill="{Binding Background, ElementName=BtnSsp}" />
</Canvas>
<Border Visibility="Hidden"
Tag="ActiveIndicator"
Panel.ZIndex="1001"
Width="4"
Height="34"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Margin="0,0,-7,0"
CornerRadius="2"
Background="{DynamicResource accentColor}" />
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Grid>
@@ -610,16 +610,16 @@
BorderBrush="{DynamicResource navigationRailBorderColor}"
BorderThickness="1"
CornerRadius="14" />
<Canvas Panel.ZIndex="1000"
Height="62"
Width="72"
Margin="62,0,0,0">
<Polygon Visibility="Hidden"
x:Name="poly_main4"
Panel.ZIndex="90"
Points="0,0 8,0 8,62 0,62"
Fill="{Binding Background, ElementName=BtnCustomLink}" />
</Canvas>
<Border Visibility="Hidden"
Tag="ActiveIndicator"
Panel.ZIndex="1001"
Width="4"
Height="34"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Margin="0,0,-7,0"
CornerRadius="2"
Background="{DynamicResource accentColor}" />
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Grid>
@@ -666,16 +666,16 @@
BorderBrush="{DynamicResource navigationRailBorderColor}"
BorderThickness="1"
CornerRadius="14" />
<Canvas Panel.ZIndex="1000"
Height="62"
Width="72"
Margin="62,0,0,0">
<Polygon Visibility="Hidden"
x:Name="poly_main4"
Panel.ZIndex="90"
Points="0,0 8,0 8,62 0,62"
Fill="{Binding Background, ElementName=BtnInfo}" />
</Canvas>
<Border Visibility="Hidden"
Tag="ActiveIndicator"
Panel.ZIndex="1001"
Width="4"
Height="34"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Margin="0,0,-7,0"
CornerRadius="2"
Background="{DynamicResource accentColor}" />
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Grid>

View File

@@ -900,6 +900,13 @@ namespace C4IT_CustomerPanel
}
}
private FrameworkElement GetActiveTabIndicator(Button button)
{
return button == null
? null
: visualHelper.FindVisualChild<FrameworkElement>(button, "ActiveIndicator");
}
public void SetMenuAktivInaktiv(object sender, bool force, bool Silent = false)
{
Button clickedButton = (Button)sender;
@@ -912,17 +919,17 @@ namespace C4IT_CustomerPanel
{
clickedButton.Background = btnColor1;
System.Windows.Shapes.Polygon polyActiveButton = visualHelper.FindVisualChild<System.Windows.Shapes.Polygon>(clickedButton);
if (polyActiveButton != null)
polyActiveButton.Visibility = Visibility.Visible;
FrameworkElement activeIndicator = GetActiveTabIndicator(clickedButton);
if (activeIndicator != null)
activeIndicator.Visibility = Visibility.Visible;
}
SolidColorBrush btnColor2 = this.ConfigSettings.GetInactiveButtonColor();
if (btnColor2 != null && ActiveButton != null)
{
ActiveButton.Background = btnColor2;
System.Windows.Shapes.Polygon polyInActiveButton = visualHelper.FindVisualChild<System.Windows.Shapes.Polygon>(ActiveButton);
if (polyInActiveButton != null)
polyInActiveButton.Visibility = Visibility.Hidden;
FrameworkElement inactiveIndicator = GetActiveTabIndicator(ActiveButton);
if (inactiveIndicator != null)
inactiveIndicator.Visibility = Visibility.Hidden;
}
ActiveButton = clickedButton;
}
@@ -1720,13 +1727,13 @@ namespace C4IT_CustomerPanel
Img.Visibility = Visibility.Visible;
}
// check, if active button -> show advanced polygon
// check, if active button -> show active tab indicator
if (bu != ActiveButton)
return;
System.Windows.Shapes.Polygon polyActiveButton = visualHelper.FindVisualChild<System.Windows.Shapes.Polygon>(bu);
if (polyActiveButton != null)
polyActiveButton.Visibility = Visibility.Visible;
FrameworkElement activeIndicator = GetActiveTabIndicator(bu);
if (activeIndicator != null)
activeIndicator.Visibility = Visibility.Visible;
}
catch (Exception E)
{