FocusControl FocusControl FocusControl FocusControl 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// You can use this class in JavaScript.
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 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// You can use this property in JavaScript.
Value
PlatForm::Boolean 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// You can use this property in JavaScript.
Value
MediaCaptureFocusState MediaCaptureFocusState MediaCaptureFocusState MediaCaptureFocusState

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

Max Max Max Max

Gets the maximum focus length.

public : unsigned int Max { get; }public uint Max { get; }Public ReadOnly Property Max As uint// You can use this property in JavaScript.
Value
unsigned int uint uint uint

The maximum focus.

Min Min Min Min

Gets the minimum focus length.

public : unsigned int Min { get; }public uint Min { get; }Public ReadOnly Property Min As uint// You can use this property in JavaScript.
Value
unsigned int 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// You can use this property in JavaScript.
Value
FocusMode FocusMode FocusMode FocusMode

The capture device's current focus mode.

Preset Preset Preset Preset

Gets the focus preset.

public : FocusPreset Preset { get; }public FocusPreset Preset { get; }Public ReadOnly Property Preset As FocusPreset// You can use this property in JavaScript.

Step Step Step Step

Gets the smallest focus increment supported by the capture device.

public : unsigned int Step { get; }public uint Step { get; }Public ReadOnly Property Step As uint// You can use this property in JavaScript.
Value
unsigned int 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 : PlatForm::Boolean Supported { get; }public bool Supported { get; }Public ReadOnly Property Supported As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean 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 VideoDeviceController 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 IReadOnlyList<ManualFocusDistance> SupportedFocusDistances { get; }Public ReadOnly Property SupportedFocusDistances As IReadOnlyList<ManualFocusDistance>// You can use this property in JavaScript.
Value
IVectorView<ManualFocusDistance> IReadOnlyList<ManualFocusDistance> IReadOnlyList<ManualFocusDistance> IReadOnlyList<ManualFocusDistance>

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 IReadOnlyList<FocusMode> SupportedFocusModes { get; }Public ReadOnly Property SupportedFocusModes As IReadOnlyList<FocusMode>// You can use this property in JavaScript.
Value
IVectorView<FocusMode> IReadOnlyList<FocusMode> IReadOnlyList<FocusMode> IReadOnlyList<FocusMode>

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 IReadOnlyList<AutoFocusRange> SupportedFocusRanges { get; }Public ReadOnly Property SupportedFocusRanges As IReadOnlyList<AutoFocusRange>// You can use this property in JavaScript.
Value
IVectorView<AutoFocusRange> IReadOnlyList<AutoFocusRange> IReadOnlyList<AutoFocusRange> IReadOnlyList<AutoFocusRange>

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 IReadOnlyList<FocusPreset> SupportedPresets { get; }Public ReadOnly Property SupportedPresets As IReadOnlyList<FocusPreset>// You can use this property in JavaScript.
Value
IVectorView<FocusPreset> IReadOnlyList<FocusPreset> IReadOnlyList<FocusPreset> IReadOnlyList<FocusPreset>

The supported focus presets.

Value Value Value Value

Gets the current value that the focus is set to.

public : unsigned int Value { get; }public uint Value { get; }Public ReadOnly Property Value As uint// You can use this property in JavaScript.
Value
unsigned int 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 specifying a value between the Min and Max focus values.

See Also

WaitForFocusSupported 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// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

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

Methods

Configure(FocusSettings) 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// You can use this method in JavaScript.
Parameters
settings
FocusSettings FocusSettings FocusSettings FocusSettings

The focus settings to use to configure the FocusControl object.

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() FocusAsync()

Asynchronously focuses the device.

public : IAsyncAction FocusAsync()public IAsyncAction FocusAsync()Public Function FocusAsync() As IAsyncAction// You can use this method in JavaScript.
Returns

The object that is used to control the asynchronous operation.

LockAsync() LockAsync() LockAsync() LockAsync()

Locks the capture device's focus.

public : IAsyncAction LockAsync()public IAsyncAction LockAsync()Public Function LockAsync() As IAsyncAction// You can use this method in JavaScript.
Returns

SetPresetAsync(FocusPreset) 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// You can use this method in JavaScript.
Parameters
preset
FocusPreset FocusPreset FocusPreset FocusPreset

The focus preset to set the Preset property to.

Returns

The object that is used to control the asynchronous operation.

See Also

SetPresetAsync(FocusPreset, Boolean) 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// You can use this method in JavaScript.
Parameters
preset
FocusPreset FocusPreset FocusPreset FocusPreset

The focus preset to set the Preset property to.

completeBeforeFocus
bool Boolean 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.

See Also

SetValueAsync(UInt32) 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// You can use this method in JavaScript.
Parameters
focus
unsigned int UInt32 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.

See Also

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// You can use this method in JavaScript.
Returns

See Also