# SelectionModelImpl

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

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

```rust
trait SelectionModelImpl<T: PropertyValue>
```

The members of [`SelectionModel`](/docs/0.5.0/api/ferroui-controls/selection/struct-selectionmodel/) that a type deriving from it can
override.

Every method receives the model and defaults to the model's own
implementation, which is the `base_*` method of the same name: an
override calls it where the managed code calls the base implementation.
A deriving type owns its model, implements this trait and registers
itself with `SelectionModel::set_derived`; every virtual call the
model makes (from its public members and from the handling of source
collection changes) then goes through the override. See the module
documentation of `selection`.

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

## Members

- [`set_source`](#function-set_source)
- [`on_source_collection_change_started`](#function-on_source_collection_change_started)
- [`on_source_collection_changed`](#function-on_source_collection_changed)
- [`on_source_collection_change_finished`](#function-on_source_collection_change_finished)
- [`on_indexes_changed`](#function-on_indexes_changed)
- [`on_source_reset`](#function-on_source_reset)
- [`on_selection_removed`](#function-on_selection_removed)
- [`on_items_added`](#function-on_items_added)
- [`on_items_removed`](#function-on_items_removed)
- [`is_valid_collection_change`](#function-is_valid_collection_change)

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

### set_source

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



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

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

### on_source_collection_change_started

```rust
fn on_source_collection_change_started(self: &Self, model: &SelectionModel<T>)
```



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

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

### on_source_collection_changed

```rust
fn on_source_collection_changed(self: &Self, model: &SelectionModel<T>, e: &ItemsChangedEventArgs<'_>)
```



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

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

### on_source_collection_change_finished

```rust
fn on_source_collection_change_finished(self: &Self, model: &SelectionModel<T>)
```



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

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

### on_indexes_changed

```rust
fn on_indexes_changed(self: &Self, model: &SelectionModel<T>, shift_index: i32, shift_delta: i32)
```



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

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

### on_source_reset

```rust
fn on_source_reset(self: &Self, model: &SelectionModel<T>)
```



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

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

### on_selection_removed

```rust
fn on_selection_removed(self: &Self, model: &SelectionModel<T>, index: i32, count: i32, deselected_items: Vec<Option<T>>)
```



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

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

### on_items_added

```rust
fn on_items_added(self: &Self, model: &SelectionModel<T>, index: i32, items: ItemsView<'_>) -> CollectionChangeState<T>
```



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

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

### on_items_removed

```rust
fn on_items_removed(self: &Self, model: &SelectionModel<T>, index: i32, items: ItemsView<'_>) -> CollectionChangeState<T>
```



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

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

### is_valid_collection_change

```rust
fn is_valid_collection_change(self: &Self, model: &SelectionModel<T>, e: &ItemsChangedEventArgs<'_>) -> bool
```



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

## Trait implementations

- [`SelectionModelImpl<Rc<dyn AnyValue>>`](/docs/0.5.0/api/ferroui-controls/selection/trait-selectionmodelimpl/)

## Availability

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