DataFormats.GetDataFormat Method

Definition

Returns a DataFormat object that defines a name and numeric ID for a specified data format.

Overloads

GetDataFormat(Int32)

Returns a DataFormat object that defines a name and numeric ID for the specified data format. The desired data format is specified by numeric ID.

GetDataFormat(String)

Returns a DataFormat object that defines a name and numeric ID for the specified data format. The desired data format is specified by name (a string).

Remarks

This method can also be used to register new formats. If the specified format cannot be found, it is automatically registered as a new data format.

GetDataFormat(Int32)

Returns a DataFormat object that defines a name and numeric ID for the specified data format. The desired data format is specified by numeric ID.

public:
 static System::Windows::DataFormat ^ GetDataFormat(int id);
public static System.Windows.DataFormat GetDataFormat (int id);
static member GetDataFormat : int -> System.Windows.DataFormat
Public Shared Function GetDataFormat (id As Integer) As DataFormat

Parameters

id
Int32

The numeric ID of the data format to request a DataFormat object for.

Returns

A DataFormat object that contains the numeric ID and the name of the requested data format.

Remarks

This method can also be used to register new formats. If the specified format cannot be found, it is automatically registered as a new data format.

GetDataFormat(String)

Returns a DataFormat object that defines a name and numeric ID for the specified data format. The desired data format is specified by name (a string).

public:
 static System::Windows::DataFormat ^ GetDataFormat(System::String ^ format);
public static System.Windows.DataFormat GetDataFormat (string format);
[System.Security.SecurityCritical]
public static System.Windows.DataFormat GetDataFormat (string format);
static member GetDataFormat : string -> System.Windows.DataFormat
Public Shared Function GetDataFormat (format As String) As DataFormat

Parameters

format
String

The name of the data format to request a DataFormat object for.

Returns

A DataFormat object that contains the numeric ID and the name of the requested data format.

Attributes

Exceptions

format is null.

Remarks

This method can also be used to register new formats. If the specified format cannot be found, it is automatically registered as a new data format.

Use of this method requires that the caller have UIPermission with the UIPermissionClipboard.AllClipboard

flag set. The following code shows the attribute syntax to request this permission for an assembly.

[assembly: SecurityPermissionAttribute(SecurityAction.RequestMinimum, Flags = UIPermissionClipboard.AllClipboard)]  
<assembly: SecurityPermissionAttribute(SecurityAction.RequestMinimum, Flags := UIPermissionClipboard.AllClipboard)>  

See also

Applies to