Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

StandardDataFormats class

Applies to Windows and Windows Phone

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


public static class StandardDataFormats

Attributes

[DualApiPartition()]
[MarshalingBehavior(Agile)]
[Version(0x06020000)]

Members

The StandardDataFormats class has these types of members:

Properties

The StandardDataFormats class has these properties.

PropertyAccess typeDescription

ApplicationLink

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

Bitmap

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

Html

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

Rtf

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

StorageItems

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

Text

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

Uri

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

WebLink

Read-onlyA read-only property that returns the format ID string value corresponding to the web link 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]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.ApplicationModel.DataTransfer
Windows::ApplicationModel::DataTransfer [C++]

Metadata

Windows.winmd

 

 

Show:
© 2014 Microsoft