Fixed EditableListBoxControl mouse wheel scrolling
This commit is contained in:
26
Filtration/Utility/VisualTreeUtility.cs
Normal file
26
Filtration/Utility/VisualTreeUtility.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.Utility
|
||||
{
|
||||
public class VisualTreeUtility
|
||||
{
|
||||
public static T FindParent<T>(DependencyObject child)
|
||||
where T : DependencyObject
|
||||
{
|
||||
//get parent item
|
||||
var parentObject = VisualTreeHelper.GetParent(child);
|
||||
|
||||
//we've reached the end of the tree
|
||||
if (parentObject == null) return null;
|
||||
|
||||
//check if the parent matches the type we're looking for
|
||||
if (parentObject is T parent)
|
||||
{
|
||||
return parent;
|
||||
}
|
||||
|
||||
return FindParent<T>(parentObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user