Esempio n. 1
0
        // </Snippet101>

        // NOTHING GETS RETURNED FROM THE FOLLOWING
        // <Snippet102>
        private void ListRequiredProperties()
        {
            AutomationProperty[] propertiesRequired;

            // Get any ControlType instance.
            ControlType controlTypeInstance = ControlType.Button;
            Type        type = typeof(ControlType);

            System.Reflection.FieldInfo[] fields = type.GetFields();
            foreach (System.Reflection.FieldInfo field in fields)
            {
                if (field.IsStatic)
                {
                    ControlType controlType = field.GetValue(controlTypeInstance) as ControlType;
                    Debug.WriteLine("\n********************");
                    Debug.WriteLine(controlType.ProgrammaticName);
                    Debug.WriteLine("Required properties:");
                    propertiesRequired = controlType.GetRequiredProperties();
                    if (propertiesRequired.GetLength(0) == 0)
                    {
                        Debug.WriteLine("(None)");
                    }
                    else
                    {
                        foreach (AutomationProperty prop in propertiesRequired)
                        {
                            Debug.WriteLine(prop.ProgrammaticName);
                        }
                    }
                }
            }
// </Snippet102>
        }