Share via


TransferTargetDiscoveryOptions Class

Definition

The TransferTargetDiscoveryOptions class provides configuration options for discovering transfer targets. It allows developers to specify criteria for filtering and prioritizing transfer targets during the discovery process.

public ref class TransferTargetDiscoveryOptions sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.ApplicationModel.DataTransfer.ITransferTargetDiscoveryOptionsFactory, 1245184, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 1245184)]
/// [Windows.Foundation.Metadata.Experimental]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class TransferTargetDiscoveryOptions final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.ApplicationModel.DataTransfer.ITransferTargetDiscoveryOptionsFactory), 1245184, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 1245184)]
[Windows.Foundation.Metadata.Experimental]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class TransferTargetDiscoveryOptions
function TransferTargetDiscoveryOptions(dataPackage)
Public NotInheritable Class TransferTargetDiscoveryOptions
Inheritance
Object Platform::Object IInspectable TransferTargetDiscoveryOptions
Attributes

Windows requirements

Requirements Description
Device family
Windows 11, version 24H2 (introduced in 10.0.26100.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v19.0)

Examples

Example: Configuring TransferTargetWatcher with Discovery Options

var options = new TransferTargetDiscoveryOptions(dataPackageView)
{
    AllowedTargetAppIds = new List<string> { "App1", "App2" },
    MaxAppTargets = 5
};

var watcher = TransferTarget.CreateWatcher(options);
watcher.Start();

Remarks

This class is used to customize the behavior of the TransferTargetWatcher when discovering transfer targets. By setting properties on this class, developers can control which targets are discovered and how they are prioritized.

Key Properties:

  • AllowedTargetAppIds: Specifies a list of app IDs that are allowed as transfer targets.
  • DataPackage: Specifies the data package used to filter relevant transfer targets.
  • MaxAppTargets: Specifies the maximum number of app targets to discover.

Usage:

The TransferTargetDiscoveryOptions class is passed to the TransferTargetWatcher to configure the discovery process.

Constructors

Name Description
TransferTargetDiscoveryOptions(DataPackageView)

Initializes a new instance of the TransferTargetDiscoveryOptions class with the specified data package. This constructor allows applications to configure discovery options based on the content being shared.

Properties

Name Description
AllowedTargetAppIds

The AllowedTargetAppIds property gets or sets a list of app IDs that are allowed as transfer targets. This property is used to filter the discovery process to include only specific apps.

DataPackage

The DataPackage property gets the data package used to filter relevant transfer targets. This property specifies the content that is being shared.

MaxAppTargets

The MaxAppTargets property gets or sets the maximum number of app targets to discover. This property limits the number of transfer targets returned during the discovery process.

Applies to

See also