* Suggestion/warning fixes for US-1889327. * Updated H2s. * Minor content edit. * Review edits. * Minor edits. * Update dotnet-desktop-guide/framework/wpf/advanced/localization-attributes-and-comments.md Co-authored-by: Andy (Steve) De George <[email protected]>
2.8 KiB
title, ms.date, ms.custom, description, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | ms.custom | description | dev_langs | helpviewer_keywords | ms.assetid | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| How to: Determine if a Data Format is Present in a Data Object | 03/30/2017 | devdivchpfy22 | Learn how to determine if a Data Format is present in a Data Object. |
|
|
e487a454-c9fc-4e53-aeaa-c458d059ad4c |
How to: Determine if a Data Format is Present in a Data Object
The following examples show how to use the various xref:System.Windows.DataObject.GetDataPresent%2A method overloads to query whether a particular data format is present in a data object.
GetDataPresent(String) overload
Description
The following example code uses the xref:System.Windows.DataObject.GetDataPresent%28System.String%29 overload to query for the presence of a particular data format by descriptor string.
Code
[!code-csharpDragDrop_DragDropMiscCode#_DragDrop_QueryDataFormats_String] [!code-vbDragDrop_DragDropMiscCode#_DragDrop_QueryDataFormats_String]
GetDataPresent(Type) overload
Description
The following example code uses the xref:System.Windows.DataObject.GetDataPresent%28System.Type%29 overload to query for the presence of a particular data format by type.
Code
[!code-csharpDragDrop_DragDropMiscCode#_DragDrop_QueryDataFormats_Type] [!code-vbDragDrop_DragDropMiscCode#_DragDrop_QueryDataFormats_Type]
GetDataPresent(String, Boolean) overload
Description
The following example code uses the xref:System.Windows.DataObject.GetDataPresent%28System.String%2CSystem.Boolean%29 overload to query for data by descriptor string, and specifying how to treat auto-convertible data formats.
Code
[!code-csharpDragDrop_DragDropMiscCode#_DragDrop_QueryDataFormats_Autoconvert] [!code-vbDragDrop_DragDropMiscCode#_DragDrop_QueryDataFormats_Autoconvert]