Group header actions and restore refresh/close button behavior

This commit is contained in:
Meik
2026-03-05 11:10:35 +01:00
parent c29ca72b2b
commit 5a1a54e9ff
2 changed files with 69 additions and 25 deletions

View File

@@ -294,6 +294,18 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<Style TargetType="Button"
x:Key="HeaderGroupButtonStyle"
BasedOn="{StaticResource HeaderIconButtonStyle}">
<Setter Property="BorderThickness"
Value="0" />
<Setter Property="Background"
Value="Transparent" />
<Setter Property="Width"
Value="32" />
<Setter Property="Height"
Value="32" />
</Style>
<DrawingImage x:Key="OverlayOffline"> <DrawingImage x:Key="OverlayOffline">
<DrawingImage.Drawing> <DrawingImage.Drawing>
@@ -341,34 +353,40 @@
HorizontalAlignment="Left" HorizontalAlignment="Left"
Margin="14,14,0,0" Margin="14,14,0,0"
x:Name="Logo" /> x:Name="Logo" />
<Button x:Name="Close_Text" <Border HorizontalAlignment="Right"
Style="{StaticResource HeaderIconButtonStyle}"
HorizontalAlignment="Right"
VerticalAlignment="Top" VerticalAlignment="Top"
Margin="0,12,12,0" Margin="0,12,12,0"
Panel.ZIndex="500" Panel.ZIndex="500"
ToolTip="{x:Static resx:Resources.close}" CornerRadius="10"
PreviewMouseDown="OnMinimizeClicked"> BorderThickness="1"
<TextBlock Text="X" BorderBrush="{DynamicResource panelBorderColor}"
FontSize="15" Background="{DynamicResource headerControlBackgroundColor}">
FontWeight="Bold" <StackPanel Orientation="Horizontal">
TextAlignment="Center" <Button x:Name="RefreshIcon"
VerticalAlignment="Center" Style="{StaticResource HeaderGroupButtonStyle}"
HorizontalAlignment="Center" /> ToolTip="Refresh"
</Button> Click="OnRefreshButtonClick">
<Button x:Name="RefreshIcon" <Image Source="{DynamicResource nav_appbar_refresh}"
Style="{StaticResource HeaderIconButtonStyle}" Tag="ICO"
HorizontalAlignment="Right" Width="16"
VerticalAlignment="Top" Height="16" />
Margin="0,12,88,0" </Button>
Panel.ZIndex="500" <Border Width="1"
ToolTip="Refresh" Margin="0,6"
PreviewMouseDown="OnRefreshClicked"> Background="{DynamicResource panelBorderColor}" />
<Image Source="{DynamicResource nav_appbar_refresh}" <Button x:Name="Close_Text"
Tag="ICO" Style="{StaticResource HeaderGroupButtonStyle}"
Width="16" ToolTip="{x:Static resx:Resources.close}"
Height="16" /> Click="OnMinimizeButtonClick">
</Button> <TextBlock Text="X"
FontSize="15"
FontWeight="Bold"
TextAlignment="Center"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Button>
</StackPanel>
</Border>
<!--<TextBlock MouseDown="OnCloseClicked" HorizontalAlignment="Right" FontSize="20" FontWeight="Bold" Margin="0,-5,5,0" Cursor="Hand" Panel.ZIndex="500" >X</TextBlock>--> <!--<TextBlock MouseDown="OnCloseClicked" HorizontalAlignment="Right" FontSize="20" FontWeight="Bold" Margin="0,-5,5,0" Cursor="Hand" Panel.ZIndex="500" >X</TextBlock>-->
<Image Source="{DynamicResource nav_appbar_network_server_disconnect}" <Image Source="{DynamicResource nav_appbar_network_server_disconnect}"
Tag="ICO" Tag="ICO"

View File

@@ -1478,6 +1478,16 @@ namespace C4IT_CustomerPanel
HideMainForm(); HideMainForm();
} }
private void OnRefreshButtonClick(object sender, RoutedEventArgs e)
{
OnRefreshClicked(sender, null);
}
private void OnMinimizeButtonClick(object sender, RoutedEventArgs e)
{
OnMinimizeClicked(sender, null);
}
private void OnNotifierMenuClicked(object sender, EventArgs e) private void OnNotifierMenuClicked(object sender, EventArgs e)
{ {
if (!(sender is ToolStripMenuItem menuItem)) if (!(sender is ToolStripMenuItem menuItem))
@@ -1606,6 +1616,9 @@ namespace C4IT_CustomerPanel
private void GridTop_MouseDown(object sender, MouseButtonEventArgs e) private void GridTop_MouseDown(object sender, MouseButtonEventArgs e)
{ {
if (e.OriginalSource is DependencyObject source && FindVisualParent<Button>(source) != null)
return;
if (e.ChangedButton == MouseButton.Left && ConfigSettings.GetConfig()._isDraggable) if (e.ChangedButton == MouseButton.Left && ConfigSettings.GetConfig()._isDraggable)
this.DragMove(); this.DragMove();
} }
@@ -1633,6 +1646,19 @@ namespace C4IT_CustomerPanel
} }
} }
private static T FindVisualParent<T>(DependencyObject source) where T : DependencyObject
{
while (source != null)
{
if (source is T target)
return target;
source = VisualTreeHelper.GetParent(source);
}
return null;
}
private void App_KeyDown(object sender, KeyEventArgs e) private void App_KeyDown(object sender, KeyEventArgs e)
{ {
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)