diff options
Diffstat (limited to 'Software/Visual_Studio/StubsUtils/Notifications.Wpf/Utils/VisualTreeHelperExtensions.cs')
| -rw-r--r-- | Software/Visual_Studio/StubsUtils/Notifications.Wpf/Utils/VisualTreeHelperExtensions.cs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Software/Visual_Studio/StubsUtils/Notifications.Wpf/Utils/VisualTreeHelperExtensions.cs b/Software/Visual_Studio/StubsUtils/Notifications.Wpf/Utils/VisualTreeHelperExtensions.cs new file mode 100644 index 000000000..e930e92da --- /dev/null +++ b/Software/Visual_Studio/StubsUtils/Notifications.Wpf/Utils/VisualTreeHelperExtensions.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media; + +namespace Notifications.Wpf.Utils +{ + internal class VisualTreeHelperExtensions + { + public static T GetParent<T>(DependencyObject child) where T : DependencyObject + { + var parent = VisualTreeHelper.GetParent(child); + + if (parent == null) return null; + + var tParent = parent as T; + if (tParent != null) + { + return tParent; + } + + return GetParent<T>(parent); + } + } +} |
