Export (0) Print
Expand All

DataObject.AddSettingDataHandler Method

Adds a SettingData event handler to a specified dependency object.

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

public static void AddSettingDataHandler(
	DependencyObject element,
	DataObjectSettingDataEventHandler handler


Type: System.Windows.DependencyObject

The dependency object (a UIElement or ContentElement) to which to add the event handler.

Type: System.Windows.DataObjectSettingDataEventHandler

A delegate that references the handler method to add.

The SettingData event occurs as part of a copy or drag command, once for each of the data formats to add to the associated data object. Typically, this event is connected to a content control, such as TextBox.

A handler for this event can be used to selectively prevent unwanted data formats from being added to the data object, thus eliminating data conversion processing for redundant data formats and improving the overall performance of a copy operation. To skip a particular data format, call the CancelCommand method and specify the format to skip in the Format property. Calling the CancelCommand method for this event does not cancel the associated copy or drag command.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft