# ISelectionAdapter

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/utils/trait-iselectionadapter/

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

```rust
trait ISelectionAdapter
```

Defines an item collection, selection members, and key handling for the
selection adapter contained in the drop-down portion of an
`AutoCompleteBox` control.

A class states that it is a selection adapter by listing
`Rc<dyn ISelectionAdapter>` among the interfaces of its class info.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/utils/i_selection_adapter.rs#L23)

## Members

- [`selected_item`](#function-selected_item)
- [`set_selected_item`](#function-set_selected_item)
- [`selection_changed`](#function-selection_changed)
- [`items_source`](#function-items_source)
- [`set_items_source`](#function-set_items_source)
- [`commit`](#function-commit)
- [`cancel`](#function-cancel)
- [`handle_key_down`](#function-handle_key_down)

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

### selected_item

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

Gets the selected item.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/utils/i_selection_adapter.rs#L25)

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

### set_selected_item

```rust
fn set_selected_item(self: &Self, value: Option<BoxedValue>)
```

Sets the selected item.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/utils/i_selection_adapter.rs#L28)

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

### selection_changed

```rust
fn selection_changed(self: &Self, handler: Rc<dyn Fn(&SelectionChangedEventArgs) -> ()>) -> Rc<dyn IDisposable>
```

Occurs when the `SelectedItem` property value changes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/utils/i_selection_adapter.rs#L31)

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

### items_source

```rust
fn items_source(self: &Self) -> Option<ItemsSource>
```

Gets a collection that is used to generate content for the
selection adapter.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/utils/i_selection_adapter.rs#L35)

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

### set_items_source

```rust
fn set_items_source(self: &Self, value: Option<ItemsSource>)
```

Sets a collection that is used to generate content for the
selection adapter.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/utils/i_selection_adapter.rs#L39)

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

### commit

```rust
fn commit(self: &Self, handler: Rc<dyn Fn(&RoutedEventArgs) -> ()>) -> Rc<dyn IDisposable>
```

Occurs when a selected item is not cancelled and is committed as the
selected item.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/utils/i_selection_adapter.rs#L43)

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

### cancel

```rust
fn cancel(self: &Self, handler: Rc<dyn Fn(&RoutedEventArgs) -> ()>) -> Rc<dyn IDisposable>
```

Occurs when a selection has been cancelled.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/utils/i_selection_adapter.rs#L46)

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

### handle_key_down

```rust
fn handle_key_down(self: &Self, e: &KeyEventArgs)
```

Provides handling for the key down event that occurs when a key is
pressed while the drop-down portion of the
`AutoCompleteBox` has focus.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/utils/i_selection_adapter.rs#L51)

## Trait implementations

- [`ISelectionAdapter`](/docs/0.5.0/api/ferroui-controls/utils/trait-iselectionadapter/)

## Availability

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