# VirtualizingPanel

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/struct-virtualizingpanel/

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

```rust
struct VirtualizingPanel
```

Base class for panels that can be used to virtualize items for an
[`ItemsControl`](/docs/0.5.0/api/ferroui-controls/struct-itemscontrol/).

Panels should implement the abstract members of this class to provide
virtualization of items in an [`ItemsControl`](/docs/0.5.0/api/ferroui-controls/struct-itemscontrol/). Derived panels can
manage scrolling by implementing the logical scrollable contract or by
listening to the effective viewport changed event.

The methods on the [`ItemContainerGenerator`](/docs/0.5.0/api/ferroui-controls/generators/struct-itemcontainergenerator/) should be used to create,
prepare and clear containers for items.

This class is abstract: its abstract members panic unless overridden.

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

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`scroll_into_view`](#function-scroll_into_view)
- [`container_from_index`](#function-container_from_index)
- [`index_from_container`](#function-index_from_container)
- [`get_realized_containers`](#function-get_realized_containers)
- [`get_control_in_direction`](#function-get_control_in_direction)
- [`on_items_control_changed`](#function-on_items_control_changed)
- [`on_items_changed`](#function-on_items_changed)
- [`construct`](#function-construct)
- [`item_container_generator`](#function-item_container_generator)
- [`items`](#function-items)
- [`items_control`](#function-items_control)
- [`add_internal_child`](#function-add_internal_child)
- [`insert_internal_child`](#function-insert_internal_child)
- [`remove_internal_child`](#function-remove_internal_child)
- [`remove_internal_child_range`](#function-remove_internal_child_range)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

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

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

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<VirtualizingPanel>
```

Returns a strong reference to this object.

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

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

### scroll_into_view

```rust
fn scroll_into_view(self: &Self, index: i32) -> Option<Ref<Control>>
```

Scrolls the specified item into view.

Returns the element with the specified index, or `None` if the
element could not be brought into view.

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

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

### container_from_index

```rust
fn container_from_index(self: &Self, index: i32) -> Option<Ref<Control>>
```

Returns the container for the item at the specified index.

Returns the container for the item at the specified index within
the item collection, if the item is realized; otherwise, `None`.

Note for implementors: if the item at the specified index is an
item-is-self-container item that has previously been realized,
then the item should be returned even if it currently falls
outside the realized viewport.

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

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

### index_from_container

```rust
fn index_from_container(self: &Self, container: &Ref<Control>) -> i32
```

Returns the index to the item that has the specified realized
container.

Returns the index to the item that corresponds to the specified
realized container, or -1 if `container` is not found.

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

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

### get_realized_containers

```rust
fn get_realized_containers(self: &Self) -> Option<Vec<Ref<Control>>>
```

Gets the currently realized containers.

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

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

### get_control_in_direction

```rust
fn get_control_in_direction(self: &Self, direction: NavigationDirection, from: Option<&Ref<InputElement>>, wrap: bool) -> Option<Ref<InputElement>>
```

Gets the next control in the specified direction.

`from` is the control from which movement begins and `wrap`
tells whether to wrap around when the first or last item is
reached.

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

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

### on_items_control_changed

```rust
fn on_items_control_changed(self: &Self, old_value: Option<&Ref<ItemsControl>>)
```

Called when the `ItemsControl` that owns the panel changes.

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

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

### on_items_changed

```rust
fn on_items_changed(self: &Self, items: &Rc<ItemsSourceView>, e: &ItemsChangedEventArgs<'_>)
```

Called when the `items` collection of the owner `ItemsControl`
changes.

This method is called a `collection changed` event is raised by
the items, or when the items property of the items control is
set to a new collection, in which case the action will be a
reset.

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

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

### construct

```rust
fn construct() -> Self
```

Creates the class data; see `ferroui_base::FerroObject::construct`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/virtualizing_panel.rs#L141)

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

### item_container_generator

```rust
fn item_container_generator(self: &Self) -> Option<Rc<ItemContainerGenerator>>
```

Gets the `ItemContainerGenerator` for this `VirtualizingPanel`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/virtualizing_panel.rs#L146)

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

### items

```rust
fn items(self: &Self) -> Rc<ItemsSourceView>
```

Gets the items to display.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/virtualizing_panel.rs#L151)

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

### items_control

```rust
fn items_control(self: &Self) -> Option<Ref<ItemsControl>>
```

Gets the `ItemsControl` that the panel is displaying items for.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/virtualizing_panel.rs#L159)

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

### add_internal_child

```rust
fn add_internal_child(self: &Self, control: &Ref<Control>)
```

Adds the specified `Control` to the children collection of a
`VirtualizingPanel` element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/virtualizing_panel.rs#L173)

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

### insert_internal_child

```rust
fn insert_internal_child(self: &Self, index: usize, control: &Ref<Control>)
```

Adds the specified `Control` to the children collection of a
`VirtualizingPanel` element at the specified index position.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/virtualizing_panel.rs#L181)

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

### remove_internal_child

```rust
fn remove_internal_child(self: &Self, child: &Ref<Control>)
```

Removes a child element from the children collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/virtualizing_panel.rs#L188)

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

### remove_internal_child_range

```rust
fn remove_internal_child_range(self: &Self, index: usize, count: usize)
```

Removes child elements from the children collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/virtualizing_panel.rs#L195)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-controlimplext/)
- [`PanelImplExt`](/docs/0.5.0/api/ferroui-controls/trait-panelimplext/)
- [`VirtualizingPanelImplExt`](/docs/0.5.0/api/ferroui-controls/trait-virtualizingpanelimplext/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- [`InputElementImplExt`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimplext/)
- [`InteractiveImplExt`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimplext/)
- [`LayoutableImplExt`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimplext/)
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`StyledElementImplExt`](/docs/0.5.0/api/ferroui-base/trait-styledelementimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- [`VisualImplExt`](/docs/0.5.0/api/ferroui-base/trait-visualimplext/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<VirtualizingPanel>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`VisualImpl`](/docs/0.5.0/api/ferroui-base/trait-visualimpl/)
- [`LayoutableImpl`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimpl/)
- [`InteractiveImpl`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimpl/)
- [`InputElementImpl`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimpl/)
- [`ControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-controlimpl/)
- [`PanelImpl`](/docs/0.5.0/api/ferroui-controls/trait-panelimpl/)
- [`VirtualizingPanelImpl`](/docs/0.5.0/api/ferroui-controls/trait-virtualizingpanelimpl/)
- [`INavigableContainer`](/docs/0.5.0/api/ferroui-base/input/trait-inavigablecontainer/)

## Availability

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