Freigeben über


IDataObject.GetDataPresent Method (String, Boolean)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Checks whether the data is available in, or can be converted to, a specified format. If the data is not already available in the specified format, a Boolean flag indicates whether to check if the data can be converted to the specified format.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Function GetDataPresent ( _
    format As String, _
    autoConvert As Boolean _
) As Boolean
bool GetDataPresent(
    string format,
    bool autoConvert
)

Parameters

  • format
    Type: System.String
    A string that specifies the format to check for. See the DataFormats class for a set of predefined data formats.
  • autoConvert
    Type: System.Boolean
    false to only check for the specified format; true to also check whether the data that is stored in this data object can be converted to the specified format.

Return Value

Type: System.Boolean
true if the data is in, or can be converted to, the specified format; otherwise, false.

Remarks

This method returns true if either of the following applies:

  • The autoConvert parameter is true, and the data is in the specified format or it can be converted to the specified format.

  • The autoConvert parameter is false, and the data is in the specified format.

This method returns false if either of the following applies:

  • The autoConvert parameter is true, and the data is not available in the specified format and cannot be converted to the specified format.

  • The autoConvert parameter is false, and the data is not available in the specified format.

Version Information

Silverlight

Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.