System.Windows.Automation.AutomationElement.GetCachedPropertyValue C# (CSharp) Method

GetCachedPropertyValue() public method

public GetCachedPropertyValue ( AutomationProperty property ) : object
property AutomationProperty
return object
        public object GetCachedPropertyValue(AutomationProperty property)
        {
            return this.GetCachedPropertyValue(property, false);
        }

Same methods

AutomationElement::GetCachedPropertyValue ( AutomationProperty property, bool ignoreDefaultValue ) : object

Usage Example

Example #1
0
        /// -------------------------------------------------------------------
        /// <summary>
        /// Test that the element's enable state is the same as 'isEnabled' argument
        /// </summary>
        /// -------------------------------------------------------------------
        internal void TS_ElementEnabled(AutomationElement element, bool isEnabled, CheckType checkType)
        {
            bool enabled;

            if (m_useCurrent)
            {
                enabled = (bool)element.GetCurrentPropertyValue(AutomationElement.IsEnabledProperty);
            }
            else
            {
                enabled = (bool)element.GetCachedPropertyValue(AutomationElement.IsEnabledProperty);
            }

            if (enabled != isEnabled)
            {
                string errorStr;
                // Adding switch instead of if statements since this is most likely
                // an enumeration instead of a t/f such as soft focus states to be add
                // later.
                switch (isEnabled)
                {
                    case true:
                        errorStr = "Element is not enabled and is expected to be enabled";
                        break;
                    case false:
                        errorStr = "Element is enabled and is expected not to be enabled";
                        break;
                    default:
                        throw new ArgumentException("Need to handle " + isEnabled);
                }
                ThrowMe(checkType, errorStr);
            }

            m_TestStep++;

        }
All Usage Examples Of System.Windows.Automation.AutomationElement::GetCachedPropertyValue