Enable header action button hit-testing in window chrome
This commit is contained in:
@@ -1616,8 +1616,14 @@ namespace C4IT_CustomerPanel
|
||||
|
||||
private void GridTop_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.OriginalSource is DependencyObject source && FindVisualParent<Button>(source) != null)
|
||||
return;
|
||||
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