// Get a current property value for this custom property
        protected object GetCurrentPropertyValue(UiaPropertyInfoHelper propInfo)
        {
            var param = new UiaParameterHelper(propInfo.UiaType);

            PatternInstance.GetProperty(propInfo.Index, 0 /* fCached */, param.GetUiaType(), param.Data);
            return(param.Value);
        }
        private void CallProperty(IInvocation invocation, UiaPropertyInfoHelper propHelper, bool cached)
        {
            // it is call for CurrentXxx property
            var param = new UiaParameterHelper(propHelper.UiaType);

            NativeMethods.WrapUiaComCall(() => _patternInstance.GetProperty(propHelper.Index, cached ? 1 : 0, propHelper.UiaType, param.Data));
            object value = param.Value;

            if (invocation.Method.ReturnType == typeof(AutomationElement))
            {
                value = AutomationElement.Wrap((IUIAutomationElement)value);
            }
            invocation.ReturnValue = value;
        }