locked
Not all controls are retrieved from an .aspx page RRS feed

  • Question

  • I can't find the WPF forum.

    I use a recursive function to locate all the controls on a .aspx page in WPF and in Asp.net, but many controls are not localized.If I use control.FindName ("Control_Name") it does find those controls.

    I need the recursive function to find all the controls because I can't go searching one by one by name.
    In this specific case of the example, dxdo are devexpress controls that contain normal controls like <grid> that are not localized.


    Example: Controls below AutoHideGroup are not found (and Form_OpcionesEx2_Panel is visible):

                            <dxdo:AutoHideGroup x:Name="Form_OpcionesEx2_AutoHideGroup">
                                <dxdo:LayoutPanel x:Name="Form_OpcionesEx2_Panel" Caption="Details" Visibility="Visible">

    My Recursive code (Resume):

    internal static dynamic Fcn_ControlFindRec(dynamic ThRead_Funciones, ref dynamic ThRead_Controles, System.Windows.DependencyObject MyContenedor, string MyControlNombre
            {   dynamic MyDynRet = null;
    
                try
                {   int MyChildrenCount = System.Windows.Media.VisualTreeHelper.GetChildrenCount(MyContenedor);
    
                    for (int index = 0; index < MyChildrenCount; index++)
                    {   System.Windows.DependencyObject MyChild = System.Windows.Media.VisualTreeHelper.GetChild(MyContenedor, index);
                        
                        MyDynRet = Name_Wpf_Control_Find.Cls_Wpf_Control_Find.Fcn_ControlFindRec(ThRead_Funciones, ref ThRead_Controles, MyChild, MyControlNombre);
                    }
                }
                catch (System.Exception ErrorExcp){}
                return MyDynRet;
            }






    • Edited by zequion1 Tuesday, May 5, 2020 6:14 AM
    • Moved by CoolDadTx Tuesday, May 5, 2020 1:29 PM ASP.NET related
    Tuesday, May 5, 2020 5:24 AM

All replies

  • Hi zequion1,

    Thank you for posting here.

    You can ask questions about WPF at Microsoft Q&A, and questions about Asp.net can be asked at the ASP.NET forum.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 5, 2020 6:20 AM