Sicherung

This commit is contained in:
Maier Stephan SI
2023-01-16 16:04:47 +01:00
parent 63512e77aa
commit 0b0508b042
98 changed files with 2454 additions and 188 deletions

View File

@@ -0,0 +1,44 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace DJ
{
public static class ScrollingHelper
{
public static void ScrollToEnd(this ListView listView)
{
var scrollViewer = GetDescendantByType(listView, typeof(ScrollViewer)) as ScrollViewer;
scrollViewer?.ScrollToEnd();
}
public static Visual GetDescendantByType(Visual element, Type type)
{
if (element != null)
{
if (element.GetType() != type)
{
Visual foundElement = null;
(element as FrameworkElement)?.ApplyTemplate();
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(element); i++)
{
var visual = VisualTreeHelper.GetChild(element, i) as Visual;
foundElement = GetDescendantByType(visual, type);
if (foundElement != null)
{
break;
}
}
return foundElement;
}
return element;
}
return null;
}
}
}