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.
Syntax
var standardDataFormats = Windows.ApplicationModel.DataTransfer.StandardDataFormats;
Attributes
- DualApiPartitionAttribute()
- MarshalingBehaviorAttribute(Agile)
- StaticAttribute(Windows.ApplicationModel.DataTransfer.IStandardDataFormatsStatics, NTDDI_WIN8)
- VersionAttribute(NTDDI_WIN8)
Members
The StandardDataFormats class has these types of members:
Methods
The StandardDataFormats class inherits methods from the Object class (C#/VB/C++).
Properties
The StandardDataFormats class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read-only | A read-only property that returns the format ID string value corresponding to the Bitmap format. | |
| Read-only | A read-only property that returns the format ID string value corresponding to the HTML format. | |
| Read-only | A read-only property that returns the format ID string value corresponding to the Rich Text Format (RTF). | |
| Read-only | A read-only property that returns the format ID string value corresponding to the StorageItem format. | |
| Read-only | A read-only property that returns the format ID string value corresponding to the Text format. | |
| Read-only | A read-only property that returns the format ID string value corresponding to the Uniform Resource Identifier (URI) format. |
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 Windows Store apps 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. |
| "FileDrop" | Stream for HGLOBAL corresponding to CF_HDROP. |
| "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 Windows Store apps and desktop apps.
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); } }); }
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps, desktop apps] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps, desktop apps] |
|
Namespace |
|
|
Metadata |
|
Build date: 2/25/2013