# ManagedDragDropService

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

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

```rust
struct ManagedDragDropService
```

Provides a lightweight, managed drag-drop state shared within the application.

This service coordinates drag state, payload, and positions for behaviors that implement an
in-process drag experience without using the drag and drop of the system.

Deviation (DEVIATIONS.md, Behaviors): the singleton of the reference is shared by the threads
of the process; the objects of the framework belong to the thread that uses them, so there is
one service per thread.

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

## Members

- [`instance`](#function-instance)
- [`is_dragging`](#function-is_dragging)
- [`payload`](#function-payload)
- [`data_format`](#function-data_format)
- [`effects`](#function-effects)
- [`origin_top_level`](#function-origin_top_level)
- [`current_client_position`](#function-current_client_position)
- [`screen_position`](#function-screen_position)
- [`drag_started`](#function-drag_started)
- [`drag_ended`](#function-drag_ended)
- [`drag_moved`](#function-drag_moved)
- [`begin`](#function-begin)
- [`move_`](#function-move_)
- [`end`](#function-end)

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

### instance

```rust
fn instance() -> Rc<ManagedDragDropService>
```

Gets the singleton instance of the service (of the thread).

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

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

### is_dragging

```rust
fn is_dragging(self: &Self) -> bool
```

Gets a value indicating whether a managed drag operation is in progress.

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

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

### payload

```rust
fn payload(self: &Self) -> Option<BoxedValue>
```

Gets the payload being dragged.

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

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

### data_format

```rust
fn data_format(self: &Self) -> Option<String>
```

Gets the data format associated with the `payload`.

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

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

### effects

```rust
fn effects(self: &Self) -> DragDropEffects
```

Gets the effective drag-drop effects requested by the drag initiator.

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

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

### origin_top_level

```rust
fn origin_top_level(self: &Self) -> Option<Ref<TopLevel>>
```

Gets the top-level where the drag originated.

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

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

### current_client_position

```rust
fn current_client_position(self: &Self) -> Point
```

Gets the current pointer position in client coordinates of the
`origin_top_level`.

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

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

### screen_position

```rust
fn screen_position(self: &Self) -> PixelPoint
```

Gets the current pointer position in screen pixel coordinates.

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

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

### drag_started

```rust
fn drag_started(self: &Self, handler: impl Fn() -> () + 'static) -> Rc<dyn IDisposable>
```

Occurs when a managed drag operation begins. Disposing the returned handle unsubscribes.

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

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

### drag_ended

```rust
fn drag_ended(self: &Self, handler: impl Fn() -> () + 'static) -> Rc<dyn IDisposable>
```

Occurs when a managed drag operation ends. Disposing the returned handle unsubscribes.

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

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

### drag_moved

```rust
fn drag_moved(self: &Self, handler: impl Fn() -> () + 'static) -> Rc<dyn IDisposable>
```

Occurs when the pointer moves during a managed drag operation. Disposing the returned
handle unsubscribes.

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

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

### begin

```rust
fn begin(self: &Self, origin: &Ref<TopLevel>, payload: Option<BoxedValue>, data_format: Option<String>, effects: DragDropEffects, start_client: Point)
```

Begins a managed drag operation from `origin` with `payload` in `data_format`, allowing
`effects`; `start_client` is the starting pointer position in client coordinates.

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

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

### move_

```rust
fn move_(self: &Self, client_position: Point)
```

Updates the current pointer position during a managed drag operation.

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

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

### end

```rust
fn end(self: &Self)
```

Ends the current managed drag operation and resets state.

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

## Trait implementations

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

## Availability

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