Focus​Control Focus​Control Focus​Control Class

Definition

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

public : sealed class FocusControl : IFocusControl, IFocusControl2public sealed class FocusControl : IFocusControl, IFocusControl2Public NotInheritable Class FocusControl Implements IFocusControl, IFocusControl2
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

You can find out if a device supports this control by checking FocusControl.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 MediaCapture.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. Or call SetValueAsync 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

FocusChangedSupported FocusChangedSupported FocusChangedSupported

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

public : PlatForm::Boolean FocusChangedSupported { get; }public bool FocusChangedSupported { get; }Public ReadOnly Property FocusChangedSupported As bool
Value
PlatForm::Boolean bool bool

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

Attributes

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
Value
MediaCaptureFocusState MediaCaptureFocusState MediaCaptureFocusState

A value indicating the current focus state of the capture device.

Attributes

Max Max Max

Gets the maximum focus length.

public : unsigned short Max { get; }public uint Max { get; }Public ReadOnly Property Max As uint
Value
unsigned short uint uint

The maximum focus.

Attributes

Min Min Min

Gets the minimum focus length.

public : unsigned short Min { get; }public uint Min { get; }Public ReadOnly Property Min As uint
Value
unsigned short uint uint

The minimum focus length.

Attributes

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
Value
FocusMode FocusMode FocusMode

The capture device's current focus mode.

Attributes

Preset Preset Preset

Gets the focus preset.

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

The focus preset.

Attributes

Step Step Step

Gets the smallest focus increment supported by the capture device.

public : unsigned short Step { get; }public uint Step { get; }Public ReadOnly Property Step As uint
Value
unsigned short uint uint

The smallest focus increment.

Attributes

Supported Supported Supported

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

public : PlatForm::Boolean Supported { get; }public bool Supported { get; }Public ReadOnly Property Supported As bool
Value
PlatForm::Boolean bool bool

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

Attributes

Remarks

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

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 IReadOnlyList<ManualFocusDistance> SupportedFocusDistances { get; }Public ReadOnly Property SupportedFocusDistances As IReadOnlyList<ManualFocusDistance>
Value
IVectorView<ManualFocusDistance> IReadOnlyList<ManualFocusDistance> IReadOnlyList<ManualFocusDistance>

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

Attributes

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 IReadOnlyList<FocusMode> SupportedFocusModes { get; }Public ReadOnly Property SupportedFocusModes As IReadOnlyList<FocusMode>
Value
IVectorView<FocusMode> IReadOnlyList<FocusMode> IReadOnlyList<FocusMode>

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

Attributes

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 IReadOnlyList<AutoFocusRange> SupportedFocusRanges { get; }Public ReadOnly Property SupportedFocusRanges As IReadOnlyList<AutoFocusRange>
Value
IVectorView<AutoFocusRange> IReadOnlyList<AutoFocusRange> IReadOnlyList<AutoFocusRange>

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

Attributes

SupportedPresets SupportedPresets SupportedPresets

Gets the focus presets that the capture device supports.

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

The supported focus presets.

Attributes

Value Value Value

Gets the current value that the focus is set to.

public : unsigned short Value { get; }public uint Value { get; }Public ReadOnly Property Value As uint
Value
unsigned short uint uint

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

Attributes

Remarks

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

See Also

WaitForFocusSupported WaitForFocusSupported WaitForFocusSupported

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

public : PlatForm::Boolean WaitForFocusSupported { get; }public bool WaitForFocusSupported { get; }Public ReadOnly Property WaitForFocusSupported As bool
Value
PlatForm::Boolean bool bool

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

Attributes

Methods

Configure(FocusSettings) Configure(FocusSettings) Configure(FocusSettings)

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

public : void Configure(FocusSettings settings)public void Configure(FocusSettings settings)Public Function Configure(settings As FocusSettings) As void
Parameters
settings
FocusSettings FocusSettings FocusSettings

The focus settings to use to configure the FocusControl object.

Attributes

Remarks

Autofocus mode, enabled by using the FocusMode.Continuous 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()

Asynchronously focuses the device.

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

The object that is used to control the asynchronous operation.

Attributes

LockAsync() LockAsync() LockAsync()

Locks the capture device's focus.

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

An asynchronous action.

Attributes

SetPresetAsync(FocusPreset) SetPresetAsync(FocusPreset) SetPresetAsync(FocusPreset)

Asynchronously sets the focus Preset.

public : IAsyncAction SetPresetAsync(FocusPreset preset)public IAsyncAction SetPresetAsync(FocusPreset preset)Public Function SetPresetAsync(preset As FocusPreset) As IAsyncAction
Parameters
preset
FocusPreset FocusPreset FocusPreset

The focus preset to set the Preset property to.

Returns

The object that is used to control the asynchronous operation.

Attributes
See Also

SetPresetAsync(FocusPreset, Boolean) SetPresetAsync(FocusPreset, Boolean) SetPresetAsync(FocusPreset, Boolean)

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

public : IAsyncAction SetPresetAsync(FocusPreset preset, bool completeBeforeFocus)public IAsyncAction SetPresetAsync(FocusPreset preset, Boolean completeBeforeFocus)Public Function SetPresetAsync(preset As FocusPreset, completeBeforeFocus As Boolean) As IAsyncAction
Parameters
preset
FocusPreset FocusPreset FocusPreset

The focus preset to set the Preset property to.

completeBeforeFocus
bool Boolean Boolean

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

Returns

The object that is used to control the asynchronous operation.

Attributes
See Also

SetValueAsync(UInt32) SetValueAsync(UInt32) SetValueAsync(UInt32)

Asynchronously sets the focus Value.

public : IAsyncAction SetValueAsync(unsigned int focus)public IAsyncAction SetValueAsync(UInt32 focus)Public Function SetValueAsync(focus As UInt32) As IAsyncAction
Parameters
focus
unsigned int UInt32 UInt32

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

Returns

The object that is used to control the asynchronous operation.

Attributes
See Also

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

An asynchronous action.

Attributes

See Also