This commit is contained in:
ShrlAlgo
2025-07-11 09:20:23 +08:00
parent c7b104f44f
commit 4d35cadb56
840 changed files with 102347 additions and 11595 deletions

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Windows.Controls;
namespace WPFDark.Internals
{
public static class ItemsControlExtensions
{
internal static IEnumerable<T> EnumerateChildren<T>(this ItemsControl self)
where T : ItemsControl
{
if (self is null)
throw new ArgumentNullException(nameof(self));
for (var i = 0; i < self.Items.Count; i++)
{
if (!(self.ItemContainerGenerator.ContainerFromIndex(i) is T item))
continue;
yield return item;
foreach (var c in item.EnumerateChildren<T>())
yield return c;
}
}
}
}