* 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.4 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: Retrieve Data in a Particular Data Format | 03/30/2017 | devdivchpfy22 | Learn how to retrieve Data in a particular Data Format. |
|
|
a625acf3-1144-44cd-add7-456aefc3859f |
How to: Retrieve Data in a Particular Data Format
The following examples show how to retrieve data from a data object in a specified format.
Use the GetDataPresent(String) overload to retrieve the data
Description
The following example code uses the xref:System.Windows.DataObject.GetDataPresent%28System.String%29 overload to first check if a specified data format is available (natively or by auto-convert); if the specified format is available, the example retrieves the data by using the xref:System.Windows.DataObject.GetData%28System.String%29 method.
Code
[!code-csharpDragDrop_DragDropMiscCode#_DragDrop_GetSpecificDataFormat] [!code-vbDragDrop_DragDropMiscCode#_DragDrop_GetSpecificDataFormat]
Use the GetDataPresent(String, Boolean) overload to retrieve the data
Description
The following example code uses the xref:System.Windows.DataObject.GetDataPresent%28System.String%2CSystem.Boolean%29 overload to first check if a specified data format is available natively (auto-convertible data formats are filtered); if the specified format is available, the example retrieves the data by using the xref:System.Windows.DataObject.GetData%28System.String%29 method.
Code
[!code-csharpDragDrop_DragDropMiscCode#_DragDrop_GetSpecificDataFormat_Native] [!code-vbDragDrop_DragDropMiscCode#_DragDrop_GetSpecificDataFormat_Native]