FocusControl FocusControl FocusControl FocusControl Class

Provides functionality for controlling the focus settings on a capture device.

Syntax

Declaration

public sealed class FocusControlpublic sealed class FocusControlPublic NotInheritable Class FocusControl

Remarks

You can find out if a device supports this control by checking Supported.

If the device does not support the FocusControl, you can still use the Focus property on the VideoCaptureDevice to set the focus value.

You can access the FocusControl for the capture device through VideoDeviceController.

The FocusControl gives apps additional control over the focus settings on a device.

You can use one of the FocusPreset values by calling SetPresetAsync(Windows.Media.Devices.FocusPreset). Or call SetValueAsync(System.UInt32) to set a specific Value between the Min and Max.

For how-to guidance for using the FocusControl, see Manual camera controls for photo and video capture.

Properties summary

Gets a value that specifics if the capture device supports the FocusChanged event.

Gets a MediaCaptureFocusState value indicating the current focus state of the capture device.

Gets the maximum focus length.

Gets the minimum focus length.

Gets the capture device's current focus mode.

Gets the focus preset.

Gets the smallest focus increment supported by the capture device.

Gets a value that specifies if the capture device supports the focus control.

Gets a list of values indicating the manual focus distances that are supported by the capture device.

Gets a list of values indicating the focus modes that are supported by the capture device.

Gets a list of values indicating the auto focus ranges that are supported by the capture device.

Gets the focus presets that the capture device supports.

Gets the current value that the focus is set to.

Gets a value that indicates whether WaitForFocus is supported by the capture device.

Methods summary

Configures the FocusControl object with values specified in the provided FocusSettings object.

Asynchronously focuses the device.

Locks the capture device's focus.

Asynchronously sets the focus Preset.

Asynchronously sets the focus Preset, specifying if the operation must complete before the device is focused.

Asynchronously sets the focus Value.

Unlocks the capture device's focus if it has previously been locked with a call to LockAsync().

Properties

  • FocusChangedSupported
    FocusChangedSupported
    FocusChangedSupported
    FocusChangedSupported

    Gets a value that specifics if the capture device supports the FocusChanged event.

    public bool FocusChangedSupported { get; }public bool FocusChangedSupported { get; }Public ReadOnly Property FocusChangedSupported As bool

    Property Value

    • bool
      bool
      bool
      bool

      true if the focus changed event is supported; otherwise, false.

  • FocusState
    FocusState
    FocusState
    FocusState

    Gets a MediaCaptureFocusState value indicating the current focus state of the capture device.

    public MediaCaptureFocusState FocusState { get; }public MediaCaptureFocusState FocusState { get; }Public ReadOnly Property FocusState As MediaCaptureFocusState

    Property Value

  • Max
    Max
    Max
    Max

    Gets the maximum focus length.

    public uint Max { get; }public uint Max { get; }Public ReadOnly Property Max As uint

    Property Value

    • uint
      uint
      uint
      uint

      The maximum focus.

  • Min
    Min
    Min
    Min

    Gets the minimum focus length.

    public uint Min { get; }public uint Min { get; }Public ReadOnly Property Min As uint

    Property Value

    • uint
      uint
      uint
      uint

      The minimum focus length.

  • Mode
    Mode
    Mode
    Mode

    Gets the capture device's current focus mode.

    public FocusMode Mode { get; }public FocusMode Mode { get; }Public ReadOnly Property Mode As FocusMode

    Property Value

  • Preset
    Preset
    Preset
    Preset

    Gets the focus preset.

    public FocusPreset Preset { get; }public FocusPreset Preset { get; }Public ReadOnly Property Preset As FocusPreset

    Property Value

  • Step
    Step
    Step
    Step

    Gets the smallest focus increment supported by the capture device.

    public uint Step { get; }public uint Step { get; }Public ReadOnly Property Step As uint

    Property Value

    • uint
      uint
      uint
      uint

      The smallest focus increment.

  • Supported
    Supported
    Supported
    Supported

    Gets a value that specifies if the capture device supports the focus control.

    public bool Supported { get; }public bool Supported { get; }Public ReadOnly Property Supported As bool

    Property Value

    • bool
      bool
      bool
      bool

      true if the capture device supports the FocusControl; otherwise, false.

    Remarks

    If the device does not support the FocusControl, you can still use the Focus property on the VideoCaptureDevice to set the focus value.

  • SupportedFocusDistances
    SupportedFocusDistances
    SupportedFocusDistances
    SupportedFocusDistances

    Gets a list of values indicating the manual focus distances that are supported by the capture device.

    public IVectorView<ManualFocusDistance> SupportedFocusDistances { get; }public IVectorView<ManualFocusDistance> SupportedFocusDistances { get; }Public ReadOnly Property SupportedFocusDistances As IVectorView<ManualFocusDistance>

    Property Value

    • A list of values indicating the manual focus distances that are supported by the capture device.

  • SupportedFocusModes
    SupportedFocusModes
    SupportedFocusModes
    SupportedFocusModes

    Gets a list of values indicating the focus modes that are supported by the capture device.

    public IVectorView<FocusMode> SupportedFocusModes { get; }public IVectorView<FocusMode> SupportedFocusModes { get; }Public ReadOnly Property SupportedFocusModes As IVectorView<FocusMode>

    Property Value

    • A list of values indicating the focus modes that are supported by the capture device.

  • SupportedFocusRanges
    SupportedFocusRanges
    SupportedFocusRanges
    SupportedFocusRanges

    Gets a list of values indicating the auto focus ranges that are supported by the capture device.

    public IVectorView<AutoFocusRange> SupportedFocusRanges { get; }public IVectorView<AutoFocusRange> SupportedFocusRanges { get; }Public ReadOnly Property SupportedFocusRanges As IVectorView<AutoFocusRange>

    Property Value

    • A list of values indicating the auto focus ranges that are supported by the capture device.

  • SupportedPresets
    SupportedPresets
    SupportedPresets
    SupportedPresets

    Gets the focus presets that the capture device supports.

    public IVectorView<FocusPreset> SupportedPresets { get; }public IVectorView<FocusPreset> SupportedPresets { get; }Public ReadOnly Property SupportedPresets As IVectorView<FocusPreset>

    Property Value

    • The supported focus presets.

  • Value
    Value
    Value
    Value

    Gets the current value that the focus is set to.

    public uint Value { get; }public uint Value { get; }Public ReadOnly Property Value As uint

    Property Value

    • uint
      uint
      uint
      uint

      The value that the focus is set to. The minimum and maximum values for the focus are specified by Min and Max.

    Remarks

    To set a focus value, call SetValueAsync(System.UInt32) specifying a value between the Min and Max focus values.

  • WaitForFocusSupported
    WaitForFocusSupported
    WaitForFocusSupported
    WaitForFocusSupported

    Gets a value that indicates whether WaitForFocus is supported by the capture device.

    public bool WaitForFocusSupported { get; }public bool WaitForFocusSupported { get; }Public ReadOnly Property WaitForFocusSupported As bool

    Property Value

    • bool
      bool
      bool
      bool

      A value indicating whether WaitForFocus is supported by the capture device.

Methods

  • Configure(Windows.Media.Devices.FocusSettings)
    Configure(Windows.Media.Devices.FocusSettings)
    Configure(Windows.Media.Devices.FocusSettings)
    Configure(Windows.Media.Devices.FocusSettings)

    Configures the FocusControl object with values specified in the provided FocusSettings object.

    public void Configure(Windows.Media.Devices.FocusSettings)public void Configure(Windows.Media.Devices.FocusSettings)Public Function Configure(Windows.Media.Devices.FocusSettings) As void

    Parameters

    Remarks

    Autofocus mode, enabled by using the FocusMode value in the FocusSettings object supplied to this method, is only supported while the preview stream is running. Check to make sure that the preview stream is running before turning on continuous autofocus.

  • FocusAsync()
    FocusAsync()
    FocusAsync()
    FocusAsync()

    Asynchronously focuses the device.

    public IAsyncAction FocusAsync()public IAsyncAction FocusAsync()Public Function FocusAsync() As IAsyncAction

    Returns

  • LockAsync()
    LockAsync()
    LockAsync()
    LockAsync()

    Locks the capture device's focus.

    public IAsyncAction LockAsync()public IAsyncAction LockAsync()Public Function LockAsync() As IAsyncAction

    Returns

  • SetPresetAsync(Windows.Media.Devices.FocusPreset)
    SetPresetAsync(Windows.Media.Devices.FocusPreset)
    SetPresetAsync(Windows.Media.Devices.FocusPreset)
    SetPresetAsync(Windows.Media.Devices.FocusPreset)

    Asynchronously sets the focus Preset.

    public IAsyncAction SetPresetAsync(Windows.Media.Devices.FocusPreset)public IAsyncAction SetPresetAsync(Windows.Media.Devices.FocusPreset)Public Function SetPresetAsync(Windows.Media.Devices.FocusPreset) As IAsyncAction

    Parameters

    Returns

  • SetPresetAsync(Windows.Media.Devices.FocusPreset,System.Boolean)
    SetPresetAsync(Windows.Media.Devices.FocusPreset,System.Boolean)
    SetPresetAsync(Windows.Media.Devices.FocusPreset,System.Boolean)
    SetPresetAsync(Windows.Media.Devices.FocusPreset,System.Boolean)

    Asynchronously sets the focus Preset, specifying if the operation must complete before the device is focused.

    public IAsyncAction SetPresetAsync(Windows.Media.Devices.FocusPreset,System.Boolean)public IAsyncAction SetPresetAsync(Windows.Media.Devices.FocusPreset,System.Boolean)Public Function SetPresetAsync(Windows.Media.Devices.FocusPreset,System.Boolean) As IAsyncAction

    Parameters

    • preset

      The focus preset to set the Preset property to.

    • completeBeforeFocus
      System.Boolean
      System.Boolean
      System.Boolean
      System.Boolean

      Specifies if the asynchronous operation must complete before the device is focused.

    Returns

  • SetValueAsync(System.UInt32)
    SetValueAsync(System.UInt32)
    SetValueAsync(System.UInt32)
    SetValueAsync(System.UInt32)

    Asynchronously sets the focus Value.

    public IAsyncAction SetValueAsync(System.UInt32)public IAsyncAction SetValueAsync(System.UInt32)Public Function SetValueAsync(System.UInt32) As IAsyncAction

    Parameters

    • focus
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The value to set the focus to. The minimum and maximum values are specified by Min and Max.

    Returns

  • UnlockAsync()
    UnlockAsync()
    UnlockAsync()
    UnlockAsync()

    Unlocks the capture device's focus if it has previously been locked with a call to LockAsync().

    public IAsyncAction UnlockAsync()public IAsyncAction UnlockAsync()Public Function UnlockAsync() As IAsyncAction

    Returns

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.Media.Devices.dll