Export (0) Print
Expand All

RangeValuePattern.RangeValuePatternInformation.Minimum Property

Gets the minimum range value supported by the UI Automation element.

Namespace:  System.Windows.Automation
Assembly:  UIAutomationClient (in UIAutomationClient.dll)

public double Minimum { get; }

Property Value

Type: System.Double
The minimum value supported by the UI Automation element or null if the element does not support Minimum. The default value is 0.0.

In the following example, an AutomationElement that supports the RangeValuePattern control pattern has its value set to the control-specific minimum value.

SetRangeValue(targetControl[0], rangeValuePattern.Current.Minimum);


...


///-------------------------------------------------------------------- 
/// <summary> 
/// Sets the range value of the control of interest. 
/// </summary> 
/// <param name="targetControl">
/// The automation element of interest. 
/// </param> 
/// <param name="rangeValue">
/// The value (either relative or absolute) to set the control to. 
/// </param> 
///-------------------------------------------------------------------- 
private void SetRangeValue(
    AutomationElement targetControl,
    double rangeValue)
{
    if (targetControl == null)
    {
        throw new ArgumentException("Argument cannot be null.");
    }

    RangeValuePattern rangeValuePattern =
        GetRangeValuePattern(targetControl);

    if (rangeValuePattern.Current.IsReadOnly)
    {
        throw new InvalidOperationException("Control is read-only.");
    }

    try
    {
        rangeValuePattern.SetValue(rangeValue);
    }
    catch (ArgumentOutOfRangeException)
    {
        // TO DO: Error handling.
    }
    catch (ArgumentException)
    {
        // TO DO: Error handling.
    }
}


...


///-------------------------------------------------------------------- 
/// <summary> 
/// Obtains a RangeValuePattern control pattern from an  
/// automation element. 
/// </summary> 
/// <param name="targetControl">
/// The automation element of interest. 
/// </param> 
/// <returns> 
/// A RangeValuePattern object. 
/// </returns> 
///-------------------------------------------------------------------- 
private RangeValuePattern GetRangeValuePattern(
    AutomationElement targetControl)
{
    RangeValuePattern rangeValuePattern = null;

    try
    {
        rangeValuePattern =
            targetControl.GetCurrentPattern(
            RangeValuePattern.Pattern)
            as RangeValuePattern;
    }
    // Object doesn't support the  
    // RangeValuePattern control pattern 
    catch (InvalidOperationException)
    {
        return null;
    }

    return rangeValuePattern;
}

.NET Framework

Supported in: 4.6, 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.

Show:
© 2014 Microsoft