/* * Copyright (c) 2025 LG Electronics Inc. * SPDX-License-Identifier: LicenseRef-LGE-Proprietary */ using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; namespace AuroraUIComponent.Util { public static class WpfUtil { #region Util - UI Component 가져오기 /// /// WPF Control 가져오기 /// /// 원하는 Control Class /// /// 원하는 Control 객체 리스트 public static List GetLogicalChildCollection(this DependencyObject parent) where T : DependencyObject { List logicalCollection = new List(); GetLogicalChildCollection(parent, logicalCollection); return logicalCollection; } private static void GetLogicalChildCollection(DependencyObject parent, List logicalCollection) where T : DependencyObject { IEnumerable children = LogicalTreeHelper.GetChildren(parent); foreach (object child in children) { if (child is DependencyObject) { DependencyObject depChild = child as DependencyObject; if (child is T) { logicalCollection.Add(child as T); } GetLogicalChildCollection(depChild, logicalCollection); } } } #endregion } }