Export (0) Print
Expand All

IRangeValueProvider.SetValue Method

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.


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

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft