Class Popup<T>
A generic base class for popups.
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public abstract class Popup<T> : Popup where T : Popup<T>
Type Parameters
| Name | Description |
|---|---|
| T | A sealed popup class type. |
Constructors
Popup(VisualElement, VisualElement, VisualElement)
Default constructor.
Declaration
protected Popup(VisualElement referenceView, VisualElement view, VisualElement contentView = null)
Parameters
| Type | Name | Description |
|---|---|---|
| VisualElement | referenceView | The reference view used as context provider for the popup. |
| VisualElement | view | The popup visual element itself. |
| VisualElement | contentView | The content that will appear inside this popup. |
Fields
m_LastFocusedElement
The last focused element before the popup was shown.
Declaration
protected Focusable m_LastFocusedElement
Field Value
| Type | Description |
|---|---|
| Focusable |
Methods
InvokeDismissedEventHandlers(DismissType)
Called when the popup has been dismissed. This method will invoke any handlers attached to the dismissed event.
Declaration
protected override void InvokeDismissedEventHandlers(DismissType reason)
Parameters
| Type | Name | Description |
|---|---|---|
| DismissType | reason | The reason for the dismissal. |
Overrides
InvokeShownEventHandlers()
Called when the popup has become visible. This method will invoke any handlers attached to the shown event.
Declaration
protected override void InvokeShownEventHandlers()
Overrides
SetContainerView(VisualElement)
Set the container view where the popup will be displayed.
Declaration
public T SetContainerView(VisualElement element)
Parameters
| Type | Name | Description |
|---|---|---|
| VisualElement | element | The container view. |
Returns
| Type | Description |
|---|---|
| T | The popup of type |
Remarks
By default, the popup will be added to popup container of the first Panel ancestor of the given reference view during construction.
SetKeyboardDismiss(bool)
Activate the possibility to dismiss the popup via Escape key or Return button.
Declaration
public T SetKeyboardDismiss(bool dismissEnabled)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | dismissEnabled |
|
Returns
| Type | Description |
|---|---|
| T | The popup of type |
SetLastFocusedElement(Focusable)
Set the last focused element before the popup was shown.
Declaration
public T SetLastFocusedElement(Focusable focusable)
Parameters
| Type | Name | Description |
|---|---|---|
| Focusable | focusable | The last focused element. |
Returns
| Type | Description |
|---|---|
| T | The popup of type |
Events
dismissed
Event triggered when the popup has been dismissed.
Declaration
public event Action<T, DismissType> dismissed
Event Type
| Type | Description |
|---|---|
| Action<T, DismissType> |
shown
Event triggered when the popup has become visible.
Declaration
public event Action<T> shown
Event Type
| Type | Description |
|---|---|
| Action<T> |