IRangeValueProvider.SetValue Method (Double)


Sets the value of the control.

Namespace:   System.Windows.Automation.Provider
Assembly:  UIAutomationProvider (in UIAutomationProvider.dll)

void SetValue(
	double value


Type: System.Double

The value to set.

Exception Condition

When value is less than the minimum or greater than the maximum value of the control.

The actual value set depends on the control implementation. The control may round the requested value up or down.

The following example shows one possible implementation of this method for a custom control. The custom control displays its range value through the alpha value of its base color.

/// <summary>
/// Sets the value of the control.
/// </summary>
/// <param name="value">
/// The value to set the control to.
/// </param>
/// <remarks>
/// For the purposes of this sample, the custom control displays 
/// its value through the alpha setting of its base color.
/// </remarks>
public void SetValue(double value)
    if (value < Minimum | value > Maximum)
        throw new ArgumentOutOfRangeException();
        Color color = customControl.controlColor;
        // Invoke control method on separate thread to avoid 
        // clashing with UI.
        // Use anonymous method for simplicity.
        this.customControl.Invoke(new MethodInvoker(delegate()
            customControl.controlColor =
                Color.FromArgb((int)value, color);

.NET Framework
Available since 3.0
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top