# DropHandlerBase

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-xaml-interactions-draganddrop/trait-drophandlerbase/

**trait** · [`ferroui-xaml-interactions-draganddrop`](/docs/0.5.0/api/ferroui-xaml-interactions-draganddrop/) · v0.5.0

```rust
trait DropHandlerBase
```

Provides helper methods for custom drop handlers.

Deviation (DEVIATIONS.md, Behaviors): the abstract class of the reference is a trait whose
methods have the bodies of the virtual methods of the class, and every type that implements it
is an [`IDropHandler`](/docs/0.5.0/api/ferroui-xaml-interactions-draganddrop/trait-idrophandler/). A handler overrides `validate` and
`execute` (and the others when it needs to); an override calls the body of the
base class through the `base_*` method of the same name. The `IList<T>` helpers work on a
`FerroList`, and the overloads of `MoveItem` and `SwapItem` that take two collections are
`move_item_between` and `swap_item_between`.
Call the methods with the trait named (`DropHandlerBase::enter(handler, ..)`)
where [`IDropHandler`](/docs/0.5.0/api/ferroui-xaml-interactions-draganddrop/trait-idrophandler/) is in scope too: the two traits have the same method names.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L20)

## Members

- [`move_item`](#function-move_item)
- [`move_item_between`](#function-move_item_between)
- [`swap_item`](#function-swap_item)
- [`swap_item_between`](#function-swap_item_between)
- [`insert_item`](#function-insert_item)
- [`enter`](#function-enter)
- [`base_enter`](#function-base_enter)
- [`over`](#function-over)
- [`base_over`](#function-base_over)
- [`drop`](#function-drop)
- [`base_drop`](#function-base_drop)
- [`leave`](#function-leave)
- [`base_leave`](#function-base_leave)
- [`validate`](#function-validate)
- [`execute`](#function-execute)
- [`cancel`](#function-cancel)

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

### move_item

```rust
fn move_item<T: Clone>(self: &Self, items: &FerroList<T>, source_index: usize, target_index: usize)
where Self: Sized
```

Moves an item within a collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L22)

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

### move_item_between

```rust
fn move_item_between<T: Clone>(self: &Self, source_items: &FerroList<T>, target_items: &FerroList<T>, source_index: usize, target_index: usize)
where Self: Sized
```

Moves an item from one collection to another.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L41)

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

### swap_item

```rust
fn swap_item<T: Clone + PartialEq>(self: &Self, items: &FerroList<T>, source_index: usize, target_index: usize)
where Self: Sized
```

Swaps two items inside a collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L56)

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

### swap_item_between

```rust
fn swap_item_between<T: Clone + PartialEq>(self: &Self, source_items: &FerroList<T>, target_items: &FerroList<T>, source_index: usize, target_index: usize)
where Self: Sized
```

Swaps an item of one collection with an item of another.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L67)

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

### insert_item

```rust
fn insert_item<T: Clone>(self: &Self, items: &FerroList<T>, item: T, index: usize)
where Self: Sized
```

Inserts an item into a collection at the specified index.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L83)

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

### enter

```rust
fn enter(self: &Self, sender: Option<&BoxedValue>, e: &DragEventArgs, source_context: Option<&BoxedValue>, target_context: Option<&BoxedValue>)
```

Called when a drag enters the target.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L91)

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

### base_enter

```rust
fn base_enter(self: &Self, sender: Option<&BoxedValue>, e: &DragEventArgs, source_context: Option<&BoxedValue>, target_context: Option<&BoxedValue>)
```

The body of `enter` of the base class: the effects the target accepts, from
`validate`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L103)

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

### over

```rust
fn over(self: &Self, sender: Option<&BoxedValue>, e: &DragEventArgs, source_context: Option<&BoxedValue>, target_context: Option<&BoxedValue>)
```

Called continuously while a drag is over the target.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L120)

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

### base_over

```rust
fn base_over(self: &Self, sender: Option<&BoxedValue>, e: &DragEventArgs, source_context: Option<&BoxedValue>, target_context: Option<&BoxedValue>)
```

The body of `over` of the base class: the effects the target accepts, from
`validate`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L132)

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

### drop

```rust
fn drop(self: &Self, sender: Option<&BoxedValue>, e: &DragEventArgs, source_context: Option<&BoxedValue>, target_context: Option<&BoxedValue>)
```

Called when the drag is dropped on the target.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L149)

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

### base_drop

```rust
fn base_drop(self: &Self, sender: Option<&BoxedValue>, e: &DragEventArgs, source_context: Option<&BoxedValue>, target_context: Option<&BoxedValue>)
```

The body of `drop` of the base class: the effects of the drop, from
`execute`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L161)

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

### leave

```rust
fn leave(self: &Self, sender: Option<&BoxedValue>, e: &RoutedEventArgs)
```

Called when the drag leaves the target.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L178)

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

### base_leave

```rust
fn base_leave(self: &Self, sender: Option<&BoxedValue>, e: &RoutedEventArgs)
```

The body of `leave` of the base class: `cancel`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L183)

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

### validate

```rust
fn validate(self: &Self, _sender: Option<&BoxedValue>, _e: &DragEventArgs, _source_context: Option<&BoxedValue>, _target_context: Option<&BoxedValue>, _state: Option<&BoxedValue>) -> bool
```

Validates whether the drag operation can be performed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L188)

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

### execute

```rust
fn execute(self: &Self, _sender: Option<&BoxedValue>, _e: &DragEventArgs, _source_context: Option<&BoxedValue>, _target_context: Option<&BoxedValue>, _state: Option<&BoxedValue>) -> bool
```

Executes the drop operation.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L200)

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

### cancel

```rust
fn cancel(self: &Self, _sender: Option<&BoxedValue>, _e: &RoutedEventArgs)
```

Cancels the drag operation.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.DragAndDrop/drop_handler_base.rs#L212)

## Trait implementations

- [`DropHandlerBase`](/docs/0.5.0/api/ferroui-xaml-interactions-draganddrop/trait-drophandlerbase/)

## Availability

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