Refine navigation UX and header action styling
This commit is contained in:
@@ -205,12 +205,18 @@
|
|||||||
Value="50"></Setter>
|
Value="50"></Setter>
|
||||||
<EventSetter Event="PreviewMouseDown"
|
<EventSetter Event="PreviewMouseDown"
|
||||||
Handler="Button_MouseDown" />
|
Handler="Button_MouseDown" />
|
||||||
|
<EventSetter Event="Click"
|
||||||
|
Handler="NavigationButton_Click" />
|
||||||
<EventSetter Event="MouseEnter"
|
<EventSetter Event="MouseEnter"
|
||||||
Handler="Button_MouseEnter" />
|
Handler="Button_MouseEnter" />
|
||||||
<EventSetter Event="MouseLeave"
|
<EventSetter Event="MouseLeave"
|
||||||
Handler="Button_MouseLeave" />
|
Handler="Button_MouseLeave" />
|
||||||
|
<EventSetter Event="KeyDown"
|
||||||
|
Handler="NavigationButton_KeyDown" />
|
||||||
<EventSetter Event="Loaded"
|
<EventSetter Event="Loaded"
|
||||||
Handler="Button_Loaded" />
|
Handler="Button_Loaded" />
|
||||||
|
<Setter Property="IsTabStop"
|
||||||
|
Value="True" />
|
||||||
<Setter Property="Background"
|
<Setter Property="Background"
|
||||||
Value="Transparent" />
|
Value="Transparent" />
|
||||||
<Setter Property="Foreground"
|
<Setter Property="Foreground"
|
||||||
@@ -252,11 +258,11 @@
|
|||||||
<Setter Property="Foreground"
|
<Setter Property="Foreground"
|
||||||
Value="{DynamicResource navForeground}" />
|
Value="{DynamicResource navForeground}" />
|
||||||
<Setter Property="Background"
|
<Setter Property="Background"
|
||||||
Value="{DynamicResource headerControlBackgroundColor}" />
|
Value="Transparent" />
|
||||||
<Setter Property="BorderBrush"
|
<Setter Property="BorderBrush"
|
||||||
Value="{DynamicResource panelBorderColor}" />
|
Value="Transparent" />
|
||||||
<Setter Property="BorderThickness"
|
<Setter Property="BorderThickness"
|
||||||
Value="1" />
|
Value="0" />
|
||||||
<Setter Property="Cursor"
|
<Setter Property="Cursor"
|
||||||
Value="Hand" />
|
Value="Hand" />
|
||||||
<Setter Property="Width"
|
<Setter Property="Width"
|
||||||
@@ -300,7 +306,7 @@
|
|||||||
<Setter Property="BorderThickness"
|
<Setter Property="BorderThickness"
|
||||||
Value="0" />
|
Value="0" />
|
||||||
<Setter Property="Background"
|
<Setter Property="Background"
|
||||||
Value="{DynamicResource headerControlBackgroundColor}" />
|
Value="Transparent" />
|
||||||
<Setter Property="Width"
|
<Setter Property="Width"
|
||||||
Value="32" />
|
Value="32" />
|
||||||
<Setter Property="Height"
|
<Setter Property="Height"
|
||||||
@@ -360,9 +366,9 @@
|
|||||||
Margin="0,12,12,0"
|
Margin="0,12,12,0"
|
||||||
Panel.ZIndex="500"
|
Panel.ZIndex="500"
|
||||||
CornerRadius="10"
|
CornerRadius="10"
|
||||||
BorderThickness="1"
|
BorderThickness="0"
|
||||||
BorderBrush="{DynamicResource panelBorderColor}"
|
BorderBrush="Transparent"
|
||||||
Background="{DynamicResource headerControlBackgroundColor}"
|
Background="Transparent"
|
||||||
shell:WindowChrome.IsHitTestVisibleInChrome="True">
|
shell:WindowChrome.IsHitTestVisibleInChrome="True">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Button x:Name="RefreshIcon"
|
<Button x:Name="RefreshIcon"
|
||||||
@@ -375,11 +381,9 @@
|
|||||||
Width="16"
|
Width="16"
|
||||||
Height="16" />
|
Height="16" />
|
||||||
</Button>
|
</Button>
|
||||||
<Border Width="1"
|
|
||||||
Margin="0,6"
|
|
||||||
Background="{DynamicResource panelBorderColor}" />
|
|
||||||
<Button x:Name="Close_Text"
|
<Button x:Name="Close_Text"
|
||||||
Style="{StaticResource HeaderGroupButtonStyle}"
|
Style="{StaticResource HeaderGroupButtonStyle}"
|
||||||
|
Margin="2,0,0,0"
|
||||||
ToolTip="{x:Static resx:Resources.close}"
|
ToolTip="{x:Static resx:Resources.close}"
|
||||||
shell:WindowChrome.IsHitTestVisibleInChrome="True"
|
shell:WindowChrome.IsHitTestVisibleInChrome="True"
|
||||||
Click="OnMinimizeButtonClick">
|
Click="OnMinimizeButtonClick">
|
||||||
|
|||||||
@@ -923,7 +923,7 @@ namespace C4IT_CustomerPanel
|
|||||||
|
|
||||||
if (ActiveButton != clickedButton)
|
if (ActiveButton != clickedButton)
|
||||||
{
|
{
|
||||||
clickedButton.Background = System.Windows.Media.Brushes.Transparent;
|
clickedButton.Background = ConfigSettings.GetActiveButtonColor();
|
||||||
FrameworkElement activeIndicator = GetActiveTabIndicator(clickedButton);
|
FrameworkElement activeIndicator = GetActiveTabIndicator(clickedButton);
|
||||||
if (activeIndicator != null)
|
if (activeIndicator != null)
|
||||||
activeIndicator.Visibility = Visibility.Visible;
|
activeIndicator.Visibility = Visibility.Visible;
|
||||||
@@ -1727,6 +1727,13 @@ namespace C4IT_CustomerPanel
|
|||||||
|
|
||||||
private void App_KeyDown(object sender, KeyEventArgs e)
|
private void App_KeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
|
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control && e.Key == Key.Tab)
|
||||||
|
{
|
||||||
|
var backwards = (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift;
|
||||||
|
e.Handled = MoveNavigationButtonFocus(Keyboard.FocusedElement as Button, backwards ? -1 : 1, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt) && Keyboard.IsKeyDown(Key.R) && ConfigSettings.GetConfig()._isDraggable)
|
if (((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt) && Keyboard.IsKeyDown(Key.R) && ConfigSettings.GetConfig()._isDraggable)
|
||||||
{
|
{
|
||||||
if (WindowState == WindowState.Normal)
|
if (WindowState == WindowState.Normal)
|
||||||
@@ -1736,6 +1743,97 @@ namespace C4IT_CustomerPanel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<Button> GetVisibleNavigationButtons()
|
||||||
|
{
|
||||||
|
if (MainFunctionButtons == null || MainFunctionButtons.Count == 0)
|
||||||
|
return new List<Button>();
|
||||||
|
|
||||||
|
return MainFunctionButtons.Values
|
||||||
|
.Where(entry => entry?.button != null && entry.button.Visibility == Visibility.Visible && entry.button.IsEnabled)
|
||||||
|
.Select(entry => entry.button)
|
||||||
|
.Distinct()
|
||||||
|
.OrderBy(button => button.Margin.Top)
|
||||||
|
.ThenBy(button => button.Name)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ActivateAndFocusNavigationButton(Button targetButton, bool activateButton)
|
||||||
|
{
|
||||||
|
if (targetButton == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
targetButton.Focus();
|
||||||
|
if (activateButton)
|
||||||
|
SetMenuAktivInaktiv(targetButton, true);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool MoveNavigationButtonFocus(Button currentButton, int step, bool activateTarget)
|
||||||
|
{
|
||||||
|
var visibleButtons = GetVisibleNavigationButtons();
|
||||||
|
if (visibleButtons.Count == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var currentIndex = visibleButtons.IndexOf(currentButton);
|
||||||
|
if (currentIndex < 0 && ActiveButton != null)
|
||||||
|
currentIndex = visibleButtons.IndexOf(ActiveButton);
|
||||||
|
if (currentIndex < 0)
|
||||||
|
currentIndex = 0;
|
||||||
|
|
||||||
|
var targetIndex = (currentIndex + step + visibleButtons.Count) % visibleButtons.Count;
|
||||||
|
return ActivateAndFocusNavigationButton(visibleButtons[targetIndex], activateTarget);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NavigationButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!(sender is Button button))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (button == ActiveButton)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SetMenuAktivInaktiv(button, true);
|
||||||
|
}
|
||||||
|
catch (Exception exp)
|
||||||
|
{
|
||||||
|
cLogManager.LogException(exp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NavigationButton_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!(sender is Button button))
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (e.Key)
|
||||||
|
{
|
||||||
|
case Key.Up:
|
||||||
|
case Key.Left:
|
||||||
|
e.Handled = MoveNavigationButtonFocus(button, -1, true);
|
||||||
|
break;
|
||||||
|
case Key.Down:
|
||||||
|
case Key.Right:
|
||||||
|
e.Handled = MoveNavigationButtonFocus(button, 1, true);
|
||||||
|
break;
|
||||||
|
case Key.Home:
|
||||||
|
e.Handled = ActivateAndFocusNavigationButton(GetVisibleNavigationButtons().FirstOrDefault(), true);
|
||||||
|
break;
|
||||||
|
case Key.End:
|
||||||
|
e.Handled = ActivateAndFocusNavigationButton(GetVisibleNavigationButtons().LastOrDefault(), true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception exp)
|
||||||
|
{
|
||||||
|
cLogManager.LogException(exp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Button_MouseEnter(object sender, EventArgs e)
|
public void Button_MouseEnter(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -1743,7 +1841,11 @@ namespace C4IT_CustomerPanel
|
|||||||
if (!(sender is Button bu))
|
if (!(sender is Button bu))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Color btnColor = ConfigSettings.GetButtonHoverColor();
|
SolidColorBrush activeBrush = ConfigSettings.GetActiveButtonColor();
|
||||||
|
if (activeBrush == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Color btnColor = ConfigSettings.GetButtonHoverColor(activeBrush.Color);
|
||||||
if (btnColor != null)
|
if (btnColor != null)
|
||||||
bu.Background = new SolidColorBrush(btnColor);
|
bu.Background = new SolidColorBrush(btnColor);
|
||||||
}
|
}
|
||||||
@@ -1760,7 +1862,9 @@ namespace C4IT_CustomerPanel
|
|||||||
if (!(sender is Button bu))
|
if (!(sender is Button bu))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bu.Background = System.Windows.Media.Brushes.Transparent;
|
bu.Background = Equals(bu, ActiveButton)
|
||||||
|
? ConfigSettings.GetActiveButtonColor()
|
||||||
|
: System.Windows.Media.Brushes.Transparent;
|
||||||
}
|
}
|
||||||
catch (Exception exp)
|
catch (Exception exp)
|
||||||
{
|
{
|
||||||
@@ -1815,6 +1919,7 @@ namespace C4IT_CustomerPanel
|
|||||||
if (bu != ActiveButton)
|
if (bu != ActiveButton)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
bu.Background = ConfigSettings.GetActiveButtonColor();
|
||||||
FrameworkElement activeIndicator = GetActiveTabIndicator(bu);
|
FrameworkElement activeIndicator = GetActiveTabIndicator(bu);
|
||||||
if (activeIndicator != null)
|
if (activeIndicator != null)
|
||||||
activeIndicator.Visibility = Visibility.Visible;
|
activeIndicator.Visibility = Visibility.Visible;
|
||||||
|
|||||||
@@ -21,13 +21,14 @@
|
|||||||
BorderBrush="{DynamicResource cardBorderColor}"
|
BorderBrush="{DynamicResource cardBorderColor}"
|
||||||
Background="{DynamicResource cardBackgroundColor}"
|
Background="{DynamicResource cardBackgroundColor}"
|
||||||
CornerRadius="12"
|
CornerRadius="12"
|
||||||
|
ClipToBounds="True"
|
||||||
MouseEnter="OnAnnMouseEnter"
|
MouseEnter="OnAnnMouseEnter"
|
||||||
MouseLeave="OnAnnMouseLeave">
|
MouseLeave="OnAnnMouseLeave">
|
||||||
<Grid Background="Transparent"
|
<Grid Background="Transparent"
|
||||||
Height="auto">
|
Height="auto">
|
||||||
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="5"/>
|
<ColumnDefinition Width="6"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<ColumnDefinition Width="auto"/>
|
<ColumnDefinition Width="auto"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
@@ -37,7 +38,12 @@
|
|||||||
<RowDefinition Height="auto"/>
|
<RowDefinition Height="auto"/>
|
||||||
<RowDefinition Height="auto"/>
|
<RowDefinition Height="auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid Background="{Binding Path=PrioColor}" Grid.RowSpan="3" x:Name="annColor"></Grid>
|
<Border Grid.RowSpan="3"
|
||||||
|
Grid.Column="0"
|
||||||
|
x:Name="annColor"
|
||||||
|
Background="{Binding Path=PrioColor}"
|
||||||
|
CornerRadius="12,0,0,12"
|
||||||
|
Margin="0" />
|
||||||
<DockPanel Grid.Column="1" >
|
<DockPanel Grid.Column="1" >
|
||||||
<Image Source="pack://application:,,,/Resources/StateOverlays/OverlayNewContentButton.png"
|
<Image Source="pack://application:,,,/Resources/StateOverlays/OverlayNewContentButton.png"
|
||||||
Panel.ZIndex="18"
|
Panel.ZIndex="18"
|
||||||
|
|||||||
@@ -200,9 +200,9 @@ namespace C4IT_CustomerPanel.libs
|
|||||||
{
|
{
|
||||||
return cpConfig._linkList;
|
return cpConfig._linkList;
|
||||||
}
|
}
|
||||||
public Color GetButtonHoverColor()
|
public Color GetButtonHoverColor(Color? baseColor = null)
|
||||||
{
|
{
|
||||||
Color activeColor = GetActiveButtonColor().Color;
|
Color activeColor = baseColor ?? GetActiveButtonColor().Color;
|
||||||
bool isLightActive = GetRelativeLuminance(activeColor) >= 0.55;
|
bool isLightActive = GetRelativeLuminance(activeColor) >= 0.55;
|
||||||
return BlendColor(activeColor, isLightActive ? Colors.Black : Colors.White, isLightActive ? 0.10 : 0.12);
|
return BlendColor(activeColor, isLightActive ? Colors.Black : Colors.White, isLightActive ? 0.10 : 0.12);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user