# TreeDataGridPresenterBase

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls-treedatagrid/primitives/struct-treedatagridpresenterbase/

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

```rust
struct TreeDataGridPresenterBase
```

The state of the reference's `TreeDataGridPresenterBase<TItem>`.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L295)

## Members

- [`new`](#function-new)
- [`element_factory`](#function-element_factory)
- [`realized_elements`](#function-realized_elements)
- [`realized_element_count`](#function-realized_element_count)
- [`is_in_layout`](#function-is_in_layout)
- [`is_layout_in_progress`](#function-is_layout_in_progress)
- [`viewport`](#function-viewport)
- [`start_u`](#function-start_u)
- [`first_index`](#function-first_index)
- [`bring_into_view`](#function-bring_into_view)
- [`get_realized_elements`](#function-get_realized_elements)
- [`try_get_element`](#function-try_get_element)
- [`recycle_all_elements`](#function-recycle_all_elements)
- [`recycle_all_elements_on_item_removed`](#function-recycle_all_elements_on_item_removed)
- [`default_measure_element`](#function-default_measure_element)
- [`get_element_from_factory_for`](#function-get_element_from_factory_for)
- [`default_get_or_estimate_anchor_element_for_viewport`](#function-default_get_or_estimate_anchor_element_for_viewport)
- [`default_estimate_element_size_u`](#function-default_estimate_element_size_u)
- [`default_on_effective_viewport_changed`](#function-default_on_effective_viewport_changed)
- [`is_viewport_covered_by_realized_elements`](#function-is_viewport_covered_by_realized_elements)
- [`measure_override`](#function-measure_override)
- [`arrange_override`](#function-arrange_override)
- [`on_attached_to_visual_tree`](#function-on_attached_to_visual_tree)
- [`on_detached_from_visual_tree`](#function-on_detached_from_visual_tree)
- [`on_detached_from_logical_tree`](#function-on_detached_from_logical_tree)
- [`subscribe_to_item_changes`](#function-subscribe_to_item_changes)
- [`unsubscribe_from_item_changes`](#function-unsubscribe_from_item_changes)
- [`on_items_collection_changed`](#function-on_items_collection_changed)

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

### new

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L333)

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

### element_factory

```rust
fn element_factory(self: &Self) -> Option<Rc<TreeDataGridElementFactory>>
```

The element factory (`ElementFactory`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L369)

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

### realized_elements

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

The realized elements, with an empty slot for each item of the realized range that has no
element yet (`RealizedElements`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L380)

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

### realized_element_count

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

The number of realized elements, empty slots included.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L385)

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

### is_in_layout

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

Whether the presenter is in its measure or arrange pass (`IsInLayout`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L390)

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

### is_layout_in_progress

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

Whether the presenter is in its measure or arrange pass (`IsLayoutInProgress`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L395)

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

### viewport

```rust
fn viewport(self: &Self) -> Rect
```

The effective viewport of the presenter, intersected with its bounds (`Viewport`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L400)

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

### start_u

```rust
fn start_u(self: &Self) -> f64
```

Gets the position of the first realized element on the primary axis (`StartU`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L405)

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

### first_index

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

The index of the first realized element (`FirstIndex`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L410)

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

### bring_into_view

```rust
fn bring_into_view<H: TreeDataGridPresenterHooks>(self: &Self, hooks: &H, index: i32, rect: Option<Rect>) -> Option<Ref<Control>>
```

Brings the item at `index` into view, realizing its element if needed (`BringIntoView`).
`rect` is the area of the element to bring into view. Returns the element, or `None` when
the item cannot be brought into view.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L423)

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

### get_realized_elements

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

The realized elements (`GetRealizedElements`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L515)

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

### try_get_element

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

The realized element of the item at `index`, if any (`TryGetElement`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L522)

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

### recycle_all_elements

```rust
fn recycle_all_elements<H: TreeDataGridPresenterHooks>(self: &Self, hooks: &H, preserve_visual_tree_membership: bool, preserve_logical_tree_membership: bool)
```

Recycles all the realized elements (`RecycleAllElements`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L527)

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

### recycle_all_elements_on_item_removed

```rust
fn recycle_all_elements_on_item_removed<H: TreeDataGridPresenterHooks>(self: &Self, hooks: &H, preserve_visual_tree_membership: bool, preserve_logical_tree_membership: bool)
```

Recycles all the realized elements as if their items were removed
(`RecycleAllElementsOnItemRemoved`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L543)

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

### default_measure_element

```rust
fn default_measure_element(element: &Control, available_size: Size) -> Size
```

The base `MeasureElement`.

Optimization: skips the measure if the element was already measured with the same
constraint and its measure is still valid. This significantly improves reattachment
performance.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L569)

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

### get_element_from_factory_for

```rust
fn get_element_from_factory_for(self: &Self, data: &dyn Any, parent: &Control) -> Ref<Control>
```

The base `GetElementFromFactory(object data, int index, Control parent)`: the element of the
element factory for `data`, preferring one recycled from `parent`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L583)

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

### default_get_or_estimate_anchor_element_for_viewport

```rust
fn default_get_or_estimate_anchor_element_for_viewport(self: &Self, viewport_start: f64, viewport_end: f64, item_count: i32) -> (i32, f64)
```

The base `GetOrEstimateAnchorElementForViewport`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L589)

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

### default_estimate_element_size_u

```rust
fn default_estimate_element_size_u(self: &Self) -> f64
```

The base `EstimateElementSizeU`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L605)

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

### default_on_effective_viewport_changed

```rust
fn default_on_effective_viewport_changed<H: TreeDataGridPresenterHooks>(self: &Self, hooks: &H, e: &EffectiveViewportChangedEventArgs)
```

The base `OnEffectiveViewportChanged`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L618)

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

### is_viewport_covered_by_realized_elements

```rust
fn is_viewport_covered_by_realized_elements(self: &Self, orientation: Orientation, viewport: Rect) -> bool
```

Whether the realized elements cover `viewport` on the primary axis
(`IsViewportCoveredByRealizedElements`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L670)

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

### measure_override

```rust
fn measure_override<H: TreeDataGridPresenterHooks>(self: &Self, hooks: &H, available_size: Size) -> Size
```

The base `MeasureOverride`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L687)

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

### arrange_override

```rust
fn arrange_override<H: TreeDataGridPresenterHooks>(self: &Self, hooks: &H, final_size: Size) -> Size
```

The base `ArrangeOverride`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L794)

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

### on_attached_to_visual_tree

```rust
fn on_attached_to_visual_tree<H: TreeDataGridPresenterHooks>(self: &Self, hooks: &H)
```

The base `OnAttachedToVisualTree`, after the parent class's.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L886)

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

### on_detached_from_visual_tree

```rust
fn on_detached_from_visual_tree<H: TreeDataGridPresenterHooks>(self: &Self, hooks: &H)
```

The base `OnDetachedFromVisualTree`, after the parent class's.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L926)

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

### on_detached_from_logical_tree

```rust
fn on_detached_from_logical_tree<H: TreeDataGridPresenterHooks>(self: &Self, hooks: &H)
```

The base `OnDetachedFromLogicalTree`, after the parent class's.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L950)

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

### subscribe_to_item_changes

```rust
fn subscribe_to_item_changes<H: TreeDataGridPresenterHooks>(self: &Self, hooks: &H)
```

Subscribes to the changes of the presenter's items, if they notify and the presenter is not
subscribed yet (`SubscribeToItemChanges`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L958)

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

### unsubscribe_from_item_changes

```rust
fn unsubscribe_from_item_changes<H: TreeDataGridPresenterHooks>(self: &Self, hooks: &H)
```

Removes the subscription to the changes of the presenter's items
(`UnsubscribeFromItemChanges`). Called before the items are replaced, while the presenter
still holds the items it subscribed to.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L975)

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

### on_items_collection_changed

```rust
fn on_items_collection_changed<H: TreeDataGridPresenterHooks>(self: &Self, hooks: &H, e: &PresenterItemsChange)
```

Handles a change of the items (`OnItemsCollectionChanged`); a presenter also calls it with
a reset when its items are replaced.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L983)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Default`

## Availability

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