# StackPanel

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

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

```rust
struct StackPanel
```

A panel which lays out its children horizontally or vertically.

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

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`arrange_child`](#function-arrange_child)
- [`get_control_in_direction`](#function-get_control_in_direction)
- [`spacing_property`](#function-spacing_property)
- [`orientation_property`](#function-orientation_property)
- [`are_horizontal_snap_points_regular_property`](#function-are_horizontal_snap_points_regular_property)
- [`are_vertical_snap_points_regular_property`](#function-are_vertical_snap_points_regular_property)
- [`horizontal_snap_points_changed_event`](#function-horizontal_snap_points_changed_event)
- [`vertical_snap_points_changed_event`](#function-vertical_snap_points_changed_event)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`spacing`](#function-spacing)
- [`set_spacing`](#function-set_spacing)
- [`orientation`](#function-orientation)
- [`set_orientation`](#function-set_orientation)
- [`horizontal_snap_points_changed`](#function-horizontal_snap_points_changed)
- [`vertical_snap_points_changed`](#function-vertical_snap_points_changed)
- [`are_horizontal_snap_points_regular`](#function-are_horizontal_snap_points_regular)
- [`set_are_horizontal_snap_points_regular`](#function-set_are_horizontal_snap_points_regular)
- [`are_vertical_snap_points_regular`](#function-are_vertical_snap_points_regular)
- [`set_are_vertical_snap_points_regular`](#function-set_are_vertical_snap_points_regular)
- [`get_irregular_snap_points`](#function-get_irregular_snap_points)
- [`get_regular_snap_points`](#function-get_regular_snap_points)

<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/stack_panel.rs#L25)

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

### to_ref

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

Returns a strong reference to this object.

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

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

### arrange_child

```rust
fn arrange_child(self: &Self, child: &Ref<Control>, rect: Rect, panel_size: Size, orientation: Orientation)
```

Arranges a single child in the slot computed by the panel.

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

<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<Control>>) -> Option<Ref<InputElement>>
```

Gets the next control in the specified direction.

`from` is the control from which movement begins.

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

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

### spacing_property

```rust
fn spacing_property() -> &'static StyledProperty<f64>
```

Defines the `Spacing` property.

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

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

### orientation_property

```rust
fn orientation_property() -> &'static StyledProperty<Orientation>
```

Defines the `Orientation` property.

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

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

### are_horizontal_snap_points_regular_property

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

Defines the `AreHorizontalSnapPointsRegular` property.

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

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

### are_vertical_snap_points_regular_property

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

Defines the `AreVerticalSnapPointsRegular` property.

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

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

### horizontal_snap_points_changed_event

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

Defines the `HorizontalSnapPointsChanged` event.

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

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

### vertical_snap_points_changed_event

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

Defines the `VerticalSnapPointsChanged` event.

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

<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/stack_panel.rs#L299)

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

### new

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



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

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

### spacing

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

The size of the spacing to place between child controls.

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

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

### set_spacing

```rust
fn set_spacing(self: &Self, value: f64)
```



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

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

### orientation

```rust
fn orientation(self: &Self) -> Orientation
```

The orientation in which child controls will be layed out.

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

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

### set_orientation

```rust
fn set_orientation(self: &Self, value: Orientation)
```



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

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

### horizontal_snap_points_changed

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

Occurs when the measurements for horizontal snap points change.

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

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

### vertical_snap_points_changed

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

Occurs when the measurements for vertical snap points change.

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

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

### are_horizontal_snap_points_regular

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

Whether the horizontal snap points for the panel are equidistant from
each other.

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

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

### set_are_horizontal_snap_points_regular

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



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

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

### are_vertical_snap_points_regular

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

Whether the vertical snap points for the panel are equidistant from
each other.

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

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

### set_are_vertical_snap_points_regular

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



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

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

### get_irregular_snap_points

```rust
fn get_irregular_snap_points(self: &Self, orientation: Orientation, snap_points_alignment: SnapPointsAlignment) -> Vec<f64>
```

Returns the set of distances between irregular snap points for a
specified orientation and alignment.

Panics if the snap points of the orientation are regular.

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

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

### get_regular_snap_points

```rust
fn get_regular_snap_points(self: &Self, _orientation: Orientation, snap_points_alignment: SnapPointsAlignment) -> (f64, f64)
```

Gets the distance between regular snap points for a specified
orientation and alignment, and the offset of the first snap point.

Panics if the snap points of the panel's orientation are not regular.

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

## 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/)
- [`StackPanelImplExt`](/docs/0.5.0/api/ferroui-controls/trait-stackpanelimplext/)
- `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<StackPanel>`](/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/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`VisualImpl`](/docs/0.5.0/api/ferroui-base/trait-visualimpl/)
- [`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/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`LayoutableImpl`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimpl/)
- [`StackPanelImpl`](/docs/0.5.0/api/ferroui-controls/trait-stackpanelimpl/)
- [`INavigableContainer`](/docs/0.5.0/api/ferroui-base/input/trait-inavigablecontainer/)
- [`IScrollSnapPointsInfo`](/docs/0.5.0/api/ferroui-controls/primitives/trait-iscrollsnappointsinfo/)

## Availability

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