Class Popover
A popup usually anchored to another UI element.
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public sealed class Popover : AnchorPopup<Popover>
Properties
modalBackdrop
Enable or disable the blocking of outside click events.
Declaration
public bool modalBackdrop { get; set; }
Property Value
Type | Description |
---|---|
bool |
resizable
True
if the popup is resizable, False
otherwise. Default is False
.
Declaration
public bool resizable { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
When the Popup is set to resizable, it will be resizable by dragging the bottom right corner.
resizeDirection
The direction of the drag.
Declaration
public Draggable.DragDirection resizeDirection { get; set; }
Property Value
Type | Description |
---|---|
Draggable.DragDirection |
Methods
Build(VisualElement, VisualElement)
Build a new Popover instance.
Declaration
public static Popover Build(VisualElement referenceView, VisualElement contentView)
Parameters
Type | Name | Description |
---|---|---|
VisualElement | referenceView | An arbitrary UI element in the current panel. |
VisualElement | contentView | The content that will appear inside this popup. |
Returns
Type | Description |
---|---|
Popover | The Popover instance. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If the referenceView is null. |
GetFocusableElement()
Returns the element that will be focused when the view will become visible.
The default value is `null`.
Declaration
protected override VisualElement GetFocusableElement()
Returns
Type | Description |
---|---|
VisualElement | The element that will be focused when the view will become visible. |
Overrides
GetMovableElement()
Method which must return the visual element that needs to be moved, based on the anchor position and size.
Declaration
public override VisualElement GetMovableElement()
Returns
Type | Description |
---|---|
VisualElement | The visual element which will be moved. The default value is view. |
Overrides
HideView(DismissType)
Called when the popup's Handler has received a k_PopupDismiss message.
Declaration
protected override void HideView(DismissType reason)
Parameters
Type | Name | Description |
---|---|---|
DismissType | reason | The reason why the popup should be dismissed. |
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
SetModalBackdrop(bool)
Enable or disable the blocking of outside click events.
Declaration
public Popover SetModalBackdrop(bool enableModalBackdrop)
Parameters
Type | Name | Description |
---|---|---|
bool | enableModalBackdrop | Whether to enable the blocking of outside click events. |
Returns
Type | Description |
---|---|
Popover | The Popover instance. |
SetResizable(bool)
Set the popup as resizable.
Declaration
public Popover SetResizable(bool isResizable)
Parameters
Type | Name | Description |
---|---|---|
bool | isResizable |
|
Returns
Type | Description |
---|---|
Popover | The popover instance. |
See Also
SetResizeDirection(DragDirection)
Set the resize direction of the popover.
Declaration
public Popover SetResizeDirection(Draggable.DragDirection direction)
Parameters
Type | Name | Description |
---|---|---|
Draggable.DragDirection | direction | The direction of the resize. |
Returns
Type | Description |
---|---|
Popover | The popover instance. |
ShouldAnimate()
Implement this method to know if the popup should call AnimateViewIn() and AnimateViewOut(DismissType) methods or not.
Declaration
protected override bool ShouldAnimate()
Returns
Type | Description |
---|---|
bool |
|
Overrides
ShouldRefreshPosition()
Method to determine if the position of the popup should be refreshed every time the anchor or the popup's content geometry changes.
Declaration
protected override bool ShouldRefreshPosition()
Returns
Type | Description |
---|---|
bool |
|