# Carousel

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

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

```rust
struct Carousel
```

An items control that displays its items as pages and can reveal adjacent
pages using `viewport_fraction`.

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

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`page_transition_property`](#function-page_transition_property)
- [`is_swipe_enabled_property`](#function-is_swipe_enabled_property)
- [`viewport_fraction_property`](#function-viewport_fraction_property)
- [`is_swiping_property`](#function-is_swiping_property)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`page_transition`](#function-page_transition)
- [`set_page_transition`](#function-set_page_transition)
- [`is_swipe_enabled`](#function-is_swipe_enabled)
- [`set_is_swipe_enabled`](#function-set_is_swipe_enabled)
- [`viewport_fraction`](#function-viewport_fraction)
- [`set_viewport_fraction`](#function-set_viewport_fraction)
- [`is_swiping`](#function-is_swiping)
- [`next`](#function-next)
- [`previous`](#function-previous)

<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/carousel.rs#L30)

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

### to_ref

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

Returns a strong reference to this object.

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

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

### page_transition_property

```rust
fn page_transition_property() -> &'static StyledProperty<Option<Rc<dyn IPageTransition>>>
```

Defines the `PageTransition` property.

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

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

### is_swipe_enabled_property

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

Defines the `IsSwipeEnabled` property.

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

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

### viewport_fraction_property

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

Defines the `ViewportFraction` property.

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

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

### is_swiping_property

```rust
fn is_swiping_property() -> &'static DirectProperty<Carousel, bool>
```

Defines the `IsSwiping` property.

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

<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/carousel.rs#L194)

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

### new

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



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

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

### page_transition

```rust
fn page_transition(self: &Self) -> Option<Rc<dyn IPageTransition>>
```

Gets or sets the transition to use when moving between pages.

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

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

### set_page_transition

```rust
fn set_page_transition(self: &Self, value: Option<Rc<dyn IPageTransition>>)
```



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

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

### is_swipe_enabled

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

Gets or sets whether swipe gestures are enabled for navigating
between pages. When enabled, mouse pointer events are also accepted
in addition to touch and pen.

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

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

### set_is_swipe_enabled

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



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

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

### viewport_fraction

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

Gets or sets the fraction of the viewport occupied by each page. A
value of 1 shows a single full page; values below 1 reveal adjacent
pages.

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

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

### set_viewport_fraction

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



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

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

### is_swiping

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

Gets a value indicating whether a swipe gesture is currently in
progress.

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

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

### next

```rust
fn next(self: &Self)
```

Moves to the next item in the carousel.

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

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

### previous

```rust
fn previous(self: &Self)
```

Moves to the previous item in the carousel.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`TemplatedControlImplExt`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimplext/)
- [`SelectingItemsControlImplExt`](/docs/0.5.0/api/ferroui-controls/primitives/trait-selectingitemscontrolimplext/)
- [`ControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-controlimplext/)
- [`ItemsControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-itemscontrolimplext/)
- `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<Carousel>`](/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/)
- [`ControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-controlimpl/)
- [`ItemsControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-itemscontrolimpl/)
- [`SelectingItemsControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-selectingitemscontrolimpl/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`InputElementImpl`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimpl/)
- [`LayoutableImpl`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimpl/)
- [`TemplatedControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimpl/)

## Availability

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