# DragDrop

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/input/struct-dragdrop/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
struct DragDrop
```

Defines the attached property and the routed events of drag-and-drop,
and starts drag-and-drop operations.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L12)

## Members

- [`TYPE`](#assoc_const-type)
- [`drag_enter_event`](#function-drag_enter_event)
- [`drag_leave_event`](#function-drag_leave_event)
- [`drag_over_event`](#function-drag_over_event)
- [`drop_event`](#function-drop_event)
- [`allow_drop_property`](#function-allow_drop_property)
- [`get_allow_drop`](#function-get_allow_drop)
- [`set_allow_drop`](#function-set_allow_drop)
- [`add_drag_enter_handler`](#function-add_drag_enter_handler)
- [`remove_drag_enter_handler`](#function-remove_drag_enter_handler)
- [`add_drag_leave_handler`](#function-add_drag_leave_handler)
- [`remove_drag_leave_handler`](#function-remove_drag_leave_handler)
- [`add_drag_over_handler`](#function-add_drag_over_handler)
- [`remove_drag_over_handler`](#function-remove_drag_over_handler)
- [`add_drop_handler`](#function-add_drop_handler)
- [`remove_drop_handler`](#function-remove_drop_handler)
- [`do_drag_drop_async`](#function-do_drag_drop_async)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this type.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L14)

<a id="function-drag_enter_event"></a>

### drag_enter_event

```rust
fn drag_enter_event() -> &'static RoutedEvent<DragEventArgs>
```

Event which is raised, when a drag-and-drop operation enters the
element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L17)

<a id="function-drag_leave_event"></a>

### drag_leave_event

```rust
fn drag_leave_event() -> &'static RoutedEvent<DragEventArgs>
```

Event which is raised, when a drag-and-drop operation leaves the
element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L25)

<a id="function-drag_over_event"></a>

### drag_over_event

```rust
fn drag_over_event() -> &'static RoutedEvent<DragEventArgs>
```

Event which is raised, when a drag-and-drop operation is updated
while over the element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L33)

<a id="function-drop_event"></a>

### drop_event

```rust
fn drop_event() -> &'static RoutedEvent<DragEventArgs>
```

Event which is raised, when a drag-and-drop operation should
complete over the element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L41)

<a id="function-allow_drop_property"></a>

### allow_drop_property

```rust
fn allow_drop_property() -> &'static AttachedProperty<bool>
```

Defines the `AllowDrop` attached property: whether the element
can be the target of a drag-and-drop operation. It is inherited.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L51)

<a id="function-get_allow_drop"></a>

### get_allow_drop

```rust
fn get_allow_drop(interactive: &Interactive) -> bool
```

Gets a value indicating whether the given element can be used as
the target of a drag-and-drop operation.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L67)

<a id="function-set_allow_drop"></a>

### set_allow_drop

```rust
fn set_allow_drop(interactive: &Interactive, value: bool)
```

Sets a value indicating whether the given element can be used as
the target of a drag-and-drop operation.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L73)

<a id="function-add_drag_enter_handler"></a>

### add_drag_enter_handler

```rust
fn add_drag_enter_handler(element: &Interactive, handler: impl Fn(&Interactive, &DragEventArgs) -> () + 'static) -> RoutedEventHandlerToken
```

Adds a handler for the DragEnter attached event.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L78)

<a id="function-remove_drag_enter_handler"></a>

### remove_drag_enter_handler

```rust
fn remove_drag_enter_handler(element: &Interactive, handler: RoutedEventHandlerToken)
```

Removes a handler for the DragEnter attached event.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L86)

<a id="function-add_drag_leave_handler"></a>

### add_drag_leave_handler

```rust
fn add_drag_leave_handler(element: &Interactive, handler: impl Fn(&Interactive, &DragEventArgs) -> () + 'static) -> RoutedEventHandlerToken
```

Adds a handler for the DragLeave attached event.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L91)

<a id="function-remove_drag_leave_handler"></a>

### remove_drag_leave_handler

```rust
fn remove_drag_leave_handler(element: &Interactive, handler: RoutedEventHandlerToken)
```

Removes a handler for the DragLeave attached event.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L99)

<a id="function-add_drag_over_handler"></a>

### add_drag_over_handler

```rust
fn add_drag_over_handler(element: &Interactive, handler: impl Fn(&Interactive, &DragEventArgs) -> () + 'static) -> RoutedEventHandlerToken
```

Adds a handler for the DragOver attached event.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L104)

<a id="function-remove_drag_over_handler"></a>

### remove_drag_over_handler

```rust
fn remove_drag_over_handler(element: &Interactive, handler: RoutedEventHandlerToken)
```

Removes a handler for the DragOver attached event.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L112)

<a id="function-add_drop_handler"></a>

### add_drop_handler

```rust
fn add_drop_handler(element: &Interactive, handler: impl Fn(&Interactive, &DragEventArgs) -> () + 'static) -> RoutedEventHandlerToken
```

Adds a handler for the Drop attached event.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L117)

<a id="function-remove_drop_handler"></a>

### remove_drop_handler

```rust
fn remove_drop_handler(element: &Interactive, handler: RoutedEventHandlerToken)
```

Removes a handler for the Drop attached event.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L125)

<a id="function-do_drag_drop_async"></a>

### do_drag_drop_async

```rust
fn do_drag_drop_async(trigger_event: &PointerPressedEventArgs, data_transfer: Rc<dyn IDataTransfer>, allowed_effects: DragDropEffects) -> LocalBoxFuture<DragDropEffects>
```

Starts a dragging operation with the given data transfer and
returns its result.

`trigger_event` is the pointer pressed event that triggered the
operation. `data_transfer` is automatically disposed when the
operation completes: it must NOT be disposed by the caller.
`allowed_effects` are the effects the source allows.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/drag_drop.rs#L136)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
