StandardDataFormats Class

Definition

Contains static properties that return string values. Each string corresponds to a known format ID. Use this class to avoid errors in using string constants to specify data formats.

public ref class StandardDataFormats abstract sealed
class StandardDataFormats abstract sealed
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.DualApiPartition(version=100794368)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Static(typeof(Windows.ApplicationModel.DataTransfer.IStandardDataFormatsStatics), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.Static(typeof(Windows.ApplicationModel.DataTransfer.IStandardDataFormatsStatics2), 65536, typeof(Windows.Foundation.UniversalApiContract))]
public static class StandardDataFormats
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.DualApiPartition(version=100794368)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Static(typeof(Windows.ApplicationModel.DataTransfer.IStandardDataFormatsStatics), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Static(typeof(Windows.ApplicationModel.DataTransfer.IStandardDataFormatsStatics2), 65536, "Windows.Foundation.UniversalApiContract")]
public static class StandardDataFormats
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.DualApiPartition(version=100794368)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Static(typeof(Windows.ApplicationModel.DataTransfer.IStandardDataFormatsStatics), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Static(typeof(Windows.ApplicationModel.DataTransfer.IStandardDataFormatsStatics2), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Static(typeof(Windows.ApplicationModel.DataTransfer.IStandardDataFormatsStatics3), 393216, "Windows.Foundation.UniversalApiContract")]
public static class StandardDataFormats
Public Class StandardDataFormats
Inheritance
StandardDataFormats
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

This example shows how to retrieve shared text.

var shareOperation = eventObject.detail.shareOperation;
if (shareOperation.data.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.text)) {
    shareOperation.data.getTextAsync().done(function (text) {
            // To output the text using this example, 
            // you need a div tag with an id of "output" in your HTML file.
            document.getElementById("output").innerText = text;
        }, function (e) {
            displayError("Error retrieving Text format: " + e);
        }
    });
}

Remarks

The DataPackage class supports several format types. Whenever you need to specify a format, we recommend using the properties of the StandardDataFormats class, instead of string values. Doing so ensures consistency between source and target applications.

The DataPackage class supports a number of legacy formats for interoperability between UWP app and desktop apps. To retrieve these formats, you pass one of the following strings to the DataPackageView.GetDataAsync method instead of a value from the StandardDataFormats class.

If format name is:GetDataAsync() retrieves:
"AnsiText"String for CF_TEXT.
"DeviceIndependentBitmap"Stream for HGLOBAL corresponding to CF_DIB.
"DeviceIndependentBitmapV5"Stream for HGLOBAL corresponding to CF_DIBV5.
"DataInterchangeFormat"Stream for HGLOBAL corresponding to CF_DIF.
"EnhancedMetafile"Stream for HENHMETAFILE corresponding to CF_ENHMETAFILE.
"Locale"Stream for HGLOBAL corresponding to CF_LOCALE
"OEMText"String for CF_OEMTEXT.
"PenData"Stream for HGLOBAL corresponding to CF_PENDATA
"RiffAudio"Stream for HGLOBAL corresponding to CF_RIFF.
"SymbolicLink"Stream for HGLOBAL corresponding to CF_SYLK.
"TaggedImageFileFormat"Stream for HGLOBAL corresponding to CF_TIFF.
"WaveAudio"Stream for HGLOBAL corresponding to CF_WAVE.

The Windows Runtime provides limited support for metafiles. Specifically, the Windows Runtime:

  • Supports rendering metafiles, but not creating them.
  • Supports the CF_ENHMETAFILE format ("EnhancedMetafile"), but not CF_METAFILEPICT.
  • Supports requesting data in "EnhancedMetafile" format, but not providing it; that is, calling SetData("EnhancedMetafile", <data>) won't work.
  • Provides limited support through the clipboard API for exchanging metafiles between UWP app and desktop apps.

Version history

Windows version SDK version Value added
1803 17134 UserActivityJsonArray

Properties

ApplicationLink

A read-only property that returns the format ID string value corresponding to the activation link format.

Bitmap

A read-only property that returns the format ID string value corresponding to the Bitmap format.

Html

A read-only property that returns the format ID string value corresponding to the HTML format.

Rtf

A read-only property that returns the format ID string value corresponding to the Rich Text Format (RTF).

StorageItems

A read-only property that returns the format ID string value corresponding to the StorageItem format.

Text

A read-only property that returns the format ID string value corresponding to the Text format.

Uri

Note

Uri may be altered or unavailable for releases after Windows 8.1. Instead, use ApplicationLink or WebLink.

A read-only property that returns the format ID string value corresponding to the Uniform Resource Identifier (URI) format.

UserActivityJsonArray

A read-only property that returns the format ID string value corresponding to the UserActivity JSON array format.

WebLink

A read-only property that returns the format ID string value corresponding to the web link format.

Applies to