Class StackView
A StackView is a container that can contain multiple items. It is similar to a stack of cards. The items are added to the stack using the Push method. The top item is the current item. The current item can be removed using the Pop method. The item below the current item becomes the new current item. The current item can be replaced using the Replace method. The item below the current item is removed and the new item is added.
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: solution.dll
Syntax
public class StackView : VisualElement, IEventHandler, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle
Constructors
Name | Description |
---|---|
StackView() | The constructor of the StackView. |
Fields
Name | Description |
---|---|
ussClassName | The main styling class of the StackView. This is the class that is used in the USS file. |
Properties
Name | Description |
---|---|
currentItem | The current item in the stack. |
depth | The depth of the stack. |
initialItem | The initial item to add to the stack. |
isBusy | Check if the StackView has any active animation. |
isEmpty | Check if the stack is empty. |
popEnterAnimation | The animation to use on the newly active item when an item is popped from the stack. |
popExitAnimation | The animation to use on the current item when it is popped from the stack. |
pushEnterAnimation | The animation to use on the newly active item when it is pushed to the stack. |
pushExitAnimation | The animation to use on the current item when a new item is pushed to the stack. |
replaceEnterAnimation | The animation to use on the newly active item when it is replaced in the stack. |
replaceExitAnimation | The animation to use on the current item when it is replaced in the stack. |
Methods
Name | Description |
---|---|
ClearStack() | Removes all items from the stack. |
Pop(StackViewItem, StackViewOperation) | Pops one or more items off the stack. |
Pop(StackViewOperation) | Pops one or more items off the stack. Only the current item is popped. |
Push(VisualElement, Action, StackViewOperation) | Pushes an item onto the stack using an optional operation. |
Replace(StackViewItem, VisualElement, Action, StackViewOperation) | Replaces one or more items on the stack with the specified item and optional operation. |
Events
Name | Description |
---|---|
currentItemChanged | Event emitted when the current item in the stack changes. |
currentItemChanging | Event emitted when the current item in the stack is about to change. |