src/Foundation/Presentation/Gimela.Presentation.Controls/Controls/Timeline/Helpers/VisualTreeExtraHelper.cs
/// <summary>
/// Don't want to change signature of below, but this actually finds a child of a type with a name
/// </summary>
/// <typeparam name="childItem"></typeparam>
/// <param name="obj"></param>
/// <param name="name"></param>
/// <returns></returns>
Don't want to change signature of below, but this actually finds a child of a type with a name
Don ' t want to change signature of below but this actually finds a child of a type with a name
public static childItem FindVisualChildByName<childItem>(DependencyObject obj, string name)
          where childItem : FrameworkElement
        {
            childItem childOfChild = null;
            DependencyObject child = null;
            for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
            {
                child = VisualTreeHelper.GetChild(obj, i);
                if (child != null && child is childItem)
                {
                    if (String.Compare(
                      (child as childItem).Name,
                      name,
                      StringComparison.CurrentCultureIgnoreCase) == 0)
                    {
                        return (childItem)child;
                    }
                }
                else
                {
                    childOfChild = FindVisualChildByName<childItem>(child, name);
                    if (childOfChild != null)
                        return childOfChild;
                }
            }
            return null;
        }
public static childItem FindVisualChildByName < childItem > ( DependencyObject obj , string name ) where childItem : FrameworkElement { childItem childOfChild = null ; DependencyObject child = null ; for ( int i = 0 ; i < VisualTreeHelper . GetChildrenCount ( obj ) ; i ++ ) { child = VisualTreeHelper . GetChild ( obj , i ) ; if ( child != null && child is childItem ) { if ( String . Compare ( ( child as childItem ) . Name , name , StringComparison . CurrentCultureIgnoreCase ) == 0 ) { return ( childItem ) child ; } } else { childOfChild = FindVisualChildByName < childItem > ( child , name ) ; if ( childOfChild != null ) return childOfChild ; } } return null ; }
Don't want to change signature of below, but this actually finds a child of a type with a name
Don ' t want to change signature of below but this actually finds a child of a type with a name
None
obj
DependencyObject
None
name
string
None
typeparam
None