# IChildIndexProvider

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/logical_tree/trait-ichildindexprovider/

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

```rust
trait IChildIndexProvider
```

Child's index and total count information provider used by list controls
and panels. Used by the nth-child and nth-last-child selectors.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/logical_tree/i_child_index_provider.rs#L8)

## Members

- [`get_child_index`](#function-get_child_index)
- [`try_get_total_count`](#function-try_get_total_count)
- [`child_index_changed`](#function-child_index_changed)

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

### get_child_index

```rust
fn get_child_index(self: &Self, child: &StyledElement) -> i32
```

Gets the index of `child` in its container, or -1 if it is not a
child.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/logical_tree/i_child_index_provider.rs#L11)

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

### try_get_total_count

```rust
fn try_get_total_count(self: &Self) -> Option<i32>
```

The total number of children, if it can be determined.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/logical_tree/i_child_index_provider.rs#L14)

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

### child_index_changed

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

Raised when the index of one or more children changes. Disposing the
returned handle unsubscribes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/logical_tree/i_child_index_provider.rs#L18)

## Availability

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