//------------------------------------------------------ // // Public Methods // //------------------------------------------------------ #region Public Methods /// <summary> /// Request to set the value that this UI element is representing /// </summary> /// <param name="value">Value to set the UI to, the provider is responsible for converting from a string into the appropriate data type</param> /// /// <outside_see conditional="false"> /// This API does not work inside the secure execution environment. /// <exception cref="System.Security.Permissions.SecurityPermission"/> /// </outside_see> public void SetValue(string value) { Misc.ValidateArgumentNonNull(value, "value"); // Test the Enabled state prior to the more general Read-Only state. object enabled = _el.GetCurrentPropertyValue(AutomationElementIdentifiers.IsEnabledProperty); if (enabled is bool && !(bool)enabled) { throw new ElementNotEnabledException(); } // Test the Read-Only state after the more specific Enabled state. object readOnly = _el.GetCurrentPropertyValue(IsReadOnlyProperty); if (readOnly is bool && (bool)readOnly) { throw new InvalidOperationException(SR.Get(SRID.ValueReadonly)); } UiaCoreApi.ValuePattern_SetValue(_hPattern, value); }