# TreeViewItem

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

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

```rust
struct TreeViewItem
```

An item in a [`TreeView`](/docs/0.5.0/api/ferroui-controls/struct-treeview/).

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

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`on_request_bring_into_view`](#function-on_request_bring_into_view)
- [`on_header_double_tapped`](#function-on_header_double_tapped)
- [`TEMPLATE_PARTS`](#assoc_const-template_parts)
- [`PSEUDO_CLASSES`](#assoc_const-pseudo_classes)
- [`is_expanded_property`](#function-is_expanded_property)
- [`is_selected_property`](#function-is_selected_property)
- [`level_property`](#function-level_property)
- [`expanded_event`](#function-expanded_event)
- [`collapsed_event`](#function-collapsed_event)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`is_expanded`](#function-is_expanded)
- [`set_is_expanded`](#function-set_is_expanded)
- [`is_selected`](#function-is_selected)
- [`set_is_selected`](#function-set_is_selected)
- [`level`](#function-level)
- [`expanded`](#function-expanded)
- [`collapsed`](#function-collapsed)

<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/tree_view_item.rs#L49)

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

### to_ref

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

Returns a strong reference to this object.

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

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

### on_request_bring_into_view

```rust
fn on_request_bring_into_view(self: &Self, e: &RequestBringIntoViewEventArgs)
```

Called when a request to bring a control into view reaches the
item.

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

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

### on_header_double_tapped

```rust
fn on_header_double_tapped(self: &Self, e: &TappedEventArgs)
```

Invoked when the double tapped event occurs in the header.

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

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

### TEMPLATE_PARTS

```rust
const TEMPLATE_PARTS: &'static [TemplatePartAttribute]
```

The named parts expected in the control template.

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

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

### PSEUDO_CLASSES

```rust
const PSEUDO_CLASSES: PseudoClassesAttribute
```

The pseudoclasses set by the class.

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

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

### is_expanded_property

```rust
fn is_expanded_property() -> &'static StyledProperty<bool>
```

Defines the `IsExpanded` property.

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

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

### is_selected_property

```rust
fn is_selected_property() -> &'static StyledProperty<bool>
```

Defines the `IsSelected` property.

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

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

### level_property

```rust
fn level_property() -> &'static DirectProperty<TreeViewItem, i32>
```

Defines the `Level` property.

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

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

### expanded_event

```rust
fn expanded_event() -> &'static RoutedEvent<RoutedEventArgs>
```

Defines the `Expanded` event.

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

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

### collapsed_event

```rust
fn collapsed_event() -> &'static RoutedEvent<RoutedEventArgs>
```

Defines the `Collapsed` event.

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

<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/tree_view_item.rs#L452)

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

### new

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



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

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

### is_expanded

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

Gets or sets a value indicating whether the item is expanded to show
its children.

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

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

### set_is_expanded

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



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

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

### is_selected

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

Gets or sets the selection state of the item.

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

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

### set_is_selected

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



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

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

### level

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

Gets the level/indentation of the item.

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

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

### expanded

```rust
fn expanded(self: &Self, handler: impl Fn(&ferroui_base::interactivity::Interactive, &RoutedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
```

Occurs after the `TreeViewItem` has expanded to show its children.

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

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

### collapsed

```rust
fn collapsed(self: &Self, handler: impl Fn(&ferroui_base::interactivity::Interactive, &RoutedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
```

Occurs after the `TreeViewItem` has collapsed to hide its children.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`TemplatedControlImplExt`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimplext/)
- [`HeaderedItemsControlImplExt`](/docs/0.5.0/api/ferroui-controls/primitives/trait-headereditemscontrolimplext/)
- [`ControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-controlimplext/)
- [`ItemsControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-itemscontrolimplext/)
- [`TreeViewItemImplExt`](/docs/0.5.0/api/ferroui-controls/trait-treeviewitemimplext/)
- `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<TreeViewItem>`](/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/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`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/)
- [`HeaderedItemsControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-headereditemscontrolimpl/)
- [`ControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-controlimpl/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`InputElementImpl`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimpl/)
- [`TemplatedControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimpl/)
- [`ItemsControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-itemscontrolimpl/)
- [`TreeViewItemImpl`](/docs/0.5.0/api/ferroui-controls/trait-treeviewitemimpl/)
- [`ISelectable`](/docs/0.5.0/api/ferroui-controls/trait-iselectable/)

## Availability

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