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