# ViewportBehavior

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-xaml-interactions-custom/struct-viewportbehavior/

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

```rust
struct ViewportBehavior
```

Listens for the associated element entering or exiting the parent `ScrollViewer` viewport.

Deviation (DEVIATIONS.md, Behaviors): the events of the behavior are Rust handler lists
(`entered_viewport` and the others, which return the subscription),
declared to markup as plain events.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/scroll_viewer/viewport_behavior.rs#L28)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`is_fully_in_viewport_property`](#function-is_fully_in_viewport_property)
- [`is_in_viewport_property`](#function-is_in_viewport_property)
- [`is_always_on_property`](#function-is_always_on_property)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`is_always_on`](#function-is_always_on)
- [`set_is_always_on`](#function-set_is_always_on)
- [`is_fully_in_viewport`](#function-is_fully_in_viewport)
- [`is_in_viewport`](#function-is_in_viewport)
- [`entered_viewport`](#function-entered_viewport)
- [`exited_viewport`](#function-exited_viewport)
- [`entering_viewport`](#function-entering_viewport)
- [`exiting_viewport`](#function-exiting_viewport)

<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/Behaviors/FerroUI.Xaml.Interactions.Custom/scroll_viewer/viewport_behavior.rs#L37)

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

### to_ref

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

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/scroll_viewer/viewport_behavior.rs#L37)

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

### is_fully_in_viewport_property

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

Identifies the `IsFullyInViewport` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/scroll_viewer/viewport_behavior.rs#L72)

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

### is_in_viewport_property

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

Identifies the `IsInViewport` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/scroll_viewer/viewport_behavior.rs#L72)

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

### is_always_on_property

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

Identifies the `IsAlwaysOn` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/scroll_viewer/viewport_behavior.rs#L72)

<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/Behaviors/FerroUI.Xaml.Interactions.Custom/scroll_viewer/viewport_behavior.rs#L139)

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

### new

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

Creates a behavior.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/scroll_viewer/viewport_behavior.rs#L151)

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

### is_always_on

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

Gets or sets a value indicating whether this behavior will remain attached after the
associated element enters the viewport. When false, the behavior will remove itself after
entering.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/scroll_viewer/viewport_behavior.rs#L158)

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

### set_is_always_on

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/scroll_viewer/viewport_behavior.rs#L162)

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

### is_fully_in_viewport

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

Gets a value indicating whether the associated element is fully in the `ScrollViewer`
viewport.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/scroll_viewer/viewport_behavior.rs#L168)

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

### is_in_viewport

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

Gets a value indicating whether the associated element is in the `ScrollViewer` viewport.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/scroll_viewer/viewport_behavior.rs#L177)

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

### entered_viewport

```rust
fn entered_viewport(self: &Self, handler: impl Fn(Option<&BoxedValue>, &EventArgs) -> () + 'static) -> Rc<dyn IDisposable>
```

Occurs when the associated element has fully entered the viewport.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/scroll_viewer/viewport_behavior.rs#L186)

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

### exited_viewport

```rust
fn exited_viewport(self: &Self, handler: impl Fn(Option<&BoxedValue>, &EventArgs) -> () + 'static) -> Rc<dyn IDisposable>
```

Occurs when the associated element has fully exited the viewport.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/scroll_viewer/viewport_behavior.rs#L191)

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

### entering_viewport

```rust
fn entering_viewport(self: &Self, handler: impl Fn(Option<&BoxedValue>, &EventArgs) -> () + 'static) -> Rc<dyn IDisposable>
```

Occurs when the associated element starts entering the viewport.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/scroll_viewer/viewport_behavior.rs#L196)

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

### exiting_viewport

```rust
fn exiting_viewport(self: &Self, handler: impl Fn(Option<&BoxedValue>, &EventArgs) -> () + 'static) -> Rc<dyn IDisposable>
```

Occurs when the associated element starts exiting the viewport.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/scroll_viewer/viewport_behavior.rs#L204)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`AttachedToVisualTreeBehaviorImplExt`](/docs/0.5.0/api/ferroui-xaml-interactions-custom/trait-attachedtovisualtreebehaviorimplext/)
- `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`
- [`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/)
- `ErasedDestructor`
- `IntoEither`
- [`DisposingBehaviorImplExt`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-disposingbehaviorimplext/)
- [`StyledElementBehaviorImplExt`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-styledelementbehaviorimplext/)
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<ViewportBehavior>`](/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/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`StyledElementBehaviorImpl`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-styledelementbehaviorimpl/)
- [`DisposingBehaviorImpl`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-disposingbehaviorimpl/)
- [`AttachedToVisualTreeBehaviorImpl`](/docs/0.5.0/api/ferroui-xaml-interactions-custom/trait-attachedtovisualtreebehaviorimpl/)

## Availability

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