# ISelectionModel

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/selection/trait-iselectionmodel/

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

```rust
trait ISelectionModel: INotifyPropertyChanged
```

The untyped contract of a selection model: the selection of an items
control.

The property changed event is raised with the names `Source`,
`SingleSelect`, `SelectedIndex`, `SelectedIndexes`, `SelectedItem`,
`SelectedItems` and `AnchorIndex`.

Each event is subscribed to with the method of its name, which returns
the handle that unsubscribes the handler when disposed.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L20)

## Members

- [`source`](#function-source)
- [`set_source`](#function-set_source)
- [`single_select`](#function-single_select)
- [`set_single_select`](#function-set_single_select)
- [`selected_index`](#function-selected_index)
- [`set_selected_index`](#function-set_selected_index)
- [`selected_indexes`](#function-selected_indexes)
- [`selected_item`](#function-selected_item)
- [`set_selected_item`](#function-set_selected_item)
- [`selected_items`](#function-selected_items)
- [`anchor_index`](#function-anchor_index)
- [`set_anchor_index`](#function-set_anchor_index)
- [`count`](#function-count)
- [`indexes_changed`](#function-indexes_changed)
- [`selection_changed`](#function-selection_changed)
- [`lost_selection`](#function-lost_selection)
- [`source_reset`](#function-source_reset)
- [`begin_batch_update`](#function-begin_batch_update)
- [`end_batch_update`](#function-end_batch_update)
- [`is_selected`](#function-is_selected)
- [`select`](#function-select)
- [`deselect`](#function-deselect)
- [`select_range`](#function-select_range)
- [`deselect_range`](#function-deselect_range)
- [`select_all`](#function-select_all)
- [`clear`](#function-clear)
- [`as_internal_selection_model`](#function-as_internal_selection_model)

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

### source

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L21)

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

### set_source

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L22)

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

### single_select

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L23)

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

### set_single_select

```rust
fn set_single_select(self: &Self, value: bool)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L24)

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

### selected_index

```rust
fn selected_index(self: &Self) -> i32
```



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

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

### set_selected_index

```rust
fn set_selected_index(self: &Self, value: i32)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L26)

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

### selected_indexes

```rust
fn selected_indexes(self: &Self) -> Rc<dyn IReadOnlySelectionList<i32>>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L27)

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

### selected_item

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



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

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

### set_selected_item

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L29)

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

### selected_items

```rust
fn selected_items(self: &Self) -> Rc<dyn IReadOnlySelectionList<Option<BoxedValue>>>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L30)

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

### anchor_index

```rust
fn anchor_index(self: &Self) -> i32
```



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

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

### set_anchor_index

```rust
fn set_anchor_index(self: &Self, value: i32)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L32)

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

### count

```rust
fn count(self: &Self) -> usize
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L33)

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

### indexes_changed

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



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

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

### selection_changed

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L36)

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

### lost_selection

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L40)

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

### source_reset

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L41)

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

### begin_batch_update

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



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

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

### end_batch_update

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L44)

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

### is_selected

```rust
fn is_selected(self: &Self, index: i32) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L45)

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

### select

```rust
fn select(self: &Self, index: i32)
```



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

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

### deselect

```rust
fn deselect(self: &Self, index: i32)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L47)

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

### select_range

```rust
fn select_range(self: &Self, start: i32, end: i32)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L48)

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

### deselect_range

```rust
fn deselect_range(self: &Self, start: i32, end: i32)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L49)

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

### select_all

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L50)

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

### clear

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



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

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

### as_internal_selection_model

```rust
fn as_internal_selection_model(self: &Self) -> Option<&super::InternalSelectionModel>
```

The model viewed as the internal selection model of the selecting
items controls, if it is one.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/i_selection_model.rs#L55)

## Trait implementations

- [`ISelectionModel`](/docs/0.5.0/api/ferroui-controls/selection/trait-iselectionmodel/)

## Availability

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