Class Modal
The Modal Popup class.
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public sealed class Modal : Popup<Modal>
Properties
fullscreenMode
Set the fullscreen mode for this Modal.
See ModalFullScreenMode values for more info.
Declaration
public ModalFullScreenMode fullscreenMode { get; set; }
Property Value
Type | Description |
---|---|
ModalFullScreenMode |
outsideClickDismissEnabled
True
if the Modal can be dismissed by clicking outside of it, False
otherwise.
Declaration
public bool outsideClickDismissEnabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
outsideClickStrategy
The strategy used to determine if the click is outside the Modal.
Declaration
public OutsideClickStrategy outsideClickStrategy { get; set; }
Property Value
Type | Description |
---|---|
OutsideClickStrategy |
Methods
Build(VisualElement, VisualElement)
Build a new Modal component.
Declaration
public static Modal Build(VisualElement referenceView, VisualElement content)
Parameters
Type | Name | Description |
---|---|---|
VisualElement | referenceView | An arbitrary UI element inside the UI panel. |
VisualElement | content | The VisualElement UI element to display inside this Modal. |
Returns
Type | Description |
---|---|
Modal | The Modal instance. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
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
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.
Declaration
protected override void InvokeShownEventHandlers()
Overrides
SetFullScreenMode(ModalFullScreenMode)
Set a new value for fullscreenMode property.
Declaration
public Modal SetFullScreenMode(ModalFullScreenMode mode)
Parameters
Type | Name | Description |
---|---|---|
ModalFullScreenMode | mode | The new value. |
Returns
Type | Description |
---|---|
Modal | The Modal object. |
SetOutsideClickDismiss(bool)
Activate the possibility to dismiss the Modal by clicking outside of it.
Declaration
public Modal SetOutsideClickDismiss(bool dismissEnabled)
Parameters
Type | Name | Description |
---|---|---|
bool | dismissEnabled |
|
Returns
Type | Description |
---|---|
Modal | The modal |
SetOutsideClickStrategy(OutsideClickStrategy)
Set the strategy used to determine if the click is outside the Modal.
Declaration
public Modal SetOutsideClickStrategy(OutsideClickStrategy strategy)
Parameters
Type | Name | Description |
---|---|---|
OutsideClickStrategy | strategy | The strategy to use. |
Returns
Type | Description |
---|---|
Modal | The modal |
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
ShouldDismiss(DismissType)
Check if the popup should be dismissed or not, depending on the reason.
Declaration
protected override bool ShouldDismiss(DismissType reason)
Parameters
Type | Name | Description |
---|---|---|
DismissType | reason | Why the element has been dismissed. |
Returns
Type | Description |
---|---|
bool |
|