44 lines
1.6 KiB
C#
44 lines
1.6 KiB
C#
/*
|
|
* 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 가져오기
|
|
/// <summary>
|
|
/// WPF Control 가져오기
|
|
/// </summary>
|
|
/// <typeparam name="T"> 원하는 Control Class </typeparam>
|
|
/// <param name="parent"></param>
|
|
/// <returns>원하는 Control 객체 리스트 </returns>
|
|
public static List<T> GetLogicalChildCollection<T>(this DependencyObject parent) where T : DependencyObject {
|
|
List<T> logicalCollection = new List<T>();
|
|
GetLogicalChildCollection(parent, logicalCollection);
|
|
return logicalCollection;
|
|
}
|
|
private static void GetLogicalChildCollection<T>(DependencyObject parent, List<T> 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
|
|
}
|
|
}
|