Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5532 from MDoerner/SuppressHorizontalBringIntoVie…
…wInGroupinGrids Suppress only horizontal scroll in inspection results window and test explorer
- Loading branch information
Showing
4 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 22 additions & 2 deletions
24
Rubberduck.Core/UI/Inspections/InspectionResultsControl.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,40 @@ | ||
namespace Rubberduck.UI.Inspections | ||
using System.Windows; | ||
|
||
namespace Rubberduck.UI.Inspections | ||
{ | ||
/// <summary> | ||
/// Interaction logic for InspectionResultsControl.xaml | ||
/// </summary> | ||
public partial class InspectionResultsControl | ||
{ | ||
private const int HorizontalRectangleAdjustment = 2000; | ||
|
||
private InspectionResultsViewModel ViewModel => DataContext as InspectionResultsViewModel; | ||
|
||
public InspectionResultsControl() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void InspectionResultsGrid_RequestBringIntoView(object sender, System.Windows.RequestBringIntoViewEventArgs e) | ||
//Based on https://stackoverflow.com/a/42238409/5536802 by Jason Williams and the comment to it by Nick Desjardins. | ||
private bool _requestingModifiedBringIntoView; | ||
private void InspectionResultsGrid_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e) | ||
{ | ||
if (_requestingModifiedBringIntoView | ||
|| !(e?.OriginalSource is FrameworkElement source)) | ||
{ | ||
return; | ||
} | ||
|
||
e.Handled = true; | ||
|
||
//Prevents adjustment of the adjusted event triggered below. | ||
_requestingModifiedBringIntoView = true; | ||
|
||
var newRectangle = new Rect(-HorizontalRectangleAdjustment, 0, source.ActualWidth + HorizontalRectangleAdjustment, source.ActualHeight); | ||
source.BringIntoView(newRectangle); | ||
|
||
_requestingModifiedBringIntoView = false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 22 additions & 2 deletions
24
Rubberduck.Core/UI/UnitTesting/TestExplorerControl.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,38 @@ | ||
namespace Rubberduck.UI.UnitTesting | ||
using System.Windows; | ||
|
||
namespace Rubberduck.UI.UnitTesting | ||
{ | ||
/// <summary> | ||
/// Interaction logic for TestExplorerControl.xaml | ||
/// </summary> | ||
public partial class TestExplorerControl | ||
{ | ||
private const int HorizontalRectangleAdjustment = 2000; | ||
|
||
public TestExplorerControl() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void TestGrid_RequestBringIntoView(object sender, System.Windows.RequestBringIntoViewEventArgs e) | ||
//Based on https://stackoverflow.com/a/42238409/5536802 by Jason Williams and the comment to it by Nick Desjardins. | ||
private bool _requestingModifiedBringIntoView; | ||
private void TestGrid_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e) | ||
{ | ||
if (_requestingModifiedBringIntoView | ||
|| !(e?.OriginalSource is FrameworkElement source)) | ||
{ | ||
return; | ||
} | ||
|
||
e.Handled = true; | ||
|
||
//Prevents adjustment of the adjusted event triggered below. | ||
_requestingModifiedBringIntoView = true; | ||
|
||
var newRectangle = new Rect(-HorizontalRectangleAdjustment, 0, source.ActualWidth + HorizontalRectangleAdjustment, source.ActualHeight); | ||
source.BringIntoView(newRectangle); | ||
|
||
_requestingModifiedBringIntoView = false; | ||
} | ||
} | ||
} |