Enable header action button hit-testing in window chrome
This commit is contained in:
@@ -353,18 +353,21 @@
|
|||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Margin="14,14,0,0"
|
Margin="14,14,0,0"
|
||||||
x:Name="Logo" />
|
x:Name="Logo" />
|
||||||
<Border HorizontalAlignment="Right"
|
<Border x:Name="HeaderActionGroup"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
Margin="0,12,12,0"
|
Margin="0,12,12,0"
|
||||||
Panel.ZIndex="500"
|
Panel.ZIndex="500"
|
||||||
CornerRadius="10"
|
CornerRadius="10"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
BorderBrush="{DynamicResource panelBorderColor}"
|
BorderBrush="{DynamicResource panelBorderColor}"
|
||||||
Background="{DynamicResource headerControlBackgroundColor}">
|
Background="{DynamicResource headerControlBackgroundColor}"
|
||||||
|
shell:WindowChrome.IsHitTestVisibleInChrome="True">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Button x:Name="RefreshIcon"
|
<Button x:Name="RefreshIcon"
|
||||||
Style="{StaticResource HeaderGroupButtonStyle}"
|
Style="{StaticResource HeaderGroupButtonStyle}"
|
||||||
ToolTip="Refresh"
|
ToolTip="Refresh"
|
||||||
|
shell:WindowChrome.IsHitTestVisibleInChrome="True"
|
||||||
Click="OnRefreshButtonClick">
|
Click="OnRefreshButtonClick">
|
||||||
<Image Source="{DynamicResource nav_appbar_refresh}"
|
<Image Source="{DynamicResource nav_appbar_refresh}"
|
||||||
Tag="ICO"
|
Tag="ICO"
|
||||||
@@ -377,6 +380,7 @@
|
|||||||
<Button x:Name="Close_Text"
|
<Button x:Name="Close_Text"
|
||||||
Style="{StaticResource HeaderGroupButtonStyle}"
|
Style="{StaticResource HeaderGroupButtonStyle}"
|
||||||
ToolTip="{x:Static resx:Resources.close}"
|
ToolTip="{x:Static resx:Resources.close}"
|
||||||
|
shell:WindowChrome.IsHitTestVisibleInChrome="True"
|
||||||
Click="OnMinimizeButtonClick">
|
Click="OnMinimizeButtonClick">
|
||||||
<TextBlock Text="X"
|
<TextBlock Text="X"
|
||||||
FontSize="15"
|
FontSize="15"
|
||||||
|
|||||||
@@ -1616,8 +1616,14 @@ 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)
|
if (e.OriginalSource is DependencyObject source)
|
||||||
return;
|
{
|
||||||
|
if (FindVisualParent<Button>(source) != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (FindVisualParent<Border>(source)?.Name == "HeaderActionGroup")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.ChangedButton == MouseButton.Left && ConfigSettings.GetConfig()._isDraggable)
|
if (e.ChangedButton == MouseButton.Left && ConfigSettings.GetConfig()._isDraggable)
|
||||||
this.DragMove();
|
this.DragMove();
|
||||||
@@ -1653,12 +1659,28 @@ namespace C4IT_CustomerPanel
|
|||||||
if (source is T target)
|
if (source is T target)
|
||||||
return target;
|
return target;
|
||||||
|
|
||||||
source = VisualTreeHelper.GetParent(source);
|
source = GetParentObject(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static DependencyObject GetParentObject(DependencyObject source)
|
||||||
|
{
|
||||||
|
if (source == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (source is ContentElement contentElement)
|
||||||
|
{
|
||||||
|
DependencyObject parent = ContentOperations.GetParent(contentElement);
|
||||||
|
if (parent == null && contentElement is FrameworkContentElement frameworkContentElement)
|
||||||
|
parent = frameworkContentElement.Parent;
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return VisualTreeHelper.GetParent(source);
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user