Class AlertDialog
AlertDialog UI element.
Inheritance
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public class AlertDialog : BaseDialog, IEventHandler, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle, IContextOverrideElement, IAdditionalDataHolder, ISizeableElement, IDismissInvocator
Remarks
Use a Modal to display an AlertDialog object.
Constructors
AlertDialog()
Default constructor.
Declaration
public AlertDialog()
Fields
cancelActionUssClassName
The AlertDialog cancel action styling class.
Declaration
public const string cancelActionUssClassName = "appui-dialog__cancel-action"
Field Value
Type | Description |
---|---|
string |
iconUssClassName
The AlertDialog icon styling class.
Declaration
public const string iconUssClassName = "appui-dialog__icon"
Field Value
Type | Description |
---|---|
string |
primaryActionUssClassName
The AlertDialog primary action styling class.
Declaration
public const string primaryActionUssClassName = "appui-dialog__primary-action"
Field Value
Type | Description |
---|---|
string |
secondaryActionUssClassName
The AlertDialog secondary action styling class.
Declaration
public const string secondaryActionUssClassName = "appui-dialog__secondary-action"
Field Value
Type | Description |
---|---|
string |
Properties
cancelButton
The AlertDialog cancel action button.
Declaration
public Button cancelButton { get; }
Property Value
Type | Description |
---|---|
Button |
isPrimaryActionDisabled
Is the primary action button disabled.
Declaration
public bool isPrimaryActionDisabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
isSecondaryActionDisabled
Is the secondary action button disabled.
Declaration
public bool isSecondaryActionDisabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
primaryButton
The AlertDialog primary action button.
Declaration
public Button primaryButton { get; }
Property Value
Type | Description |
---|---|
Button |
secondaryButton
The AlertDialog secondary action button.
Declaration
public Button secondaryButton { get; }
Property Value
Type | Description |
---|---|
Button |
variant
The current variant used by the AlertDialog.
Declaration
[Tooltip("The current semantic variant used by the AlertDialog.")]
public AlertSemantic variant { get; set; }
Property Value
Type | Description |
---|---|
AlertSemantic |
Methods
SetCancelAction(int, string)
Bind an Action as the cancel action of the Alert.
Declaration
public void SetCancelAction(int actionId, string displayText)
Parameters
Type | Name | Description |
---|---|---|
int | actionId | The Action Identifier. |
string | displayText | The text to display inside the action's button. |
SetPrimaryAction(int, string, Action)
Bind an Action as the primary action of the Alert.
Declaration
public void SetPrimaryAction(int actionId, string displayText, Action callback)
Parameters
Type | Name | Description |
---|---|---|
int | actionId | The Action Identifier. |
string | displayText | The text to display inside the action's button. |
Action | callback | The callback invoked if the action is triggered. |
SetSecondaryAction(int, string, Action)
Bind an Action as the secondary action of the Alert.
Declaration
public void SetSecondaryAction(int actionId, string displayText, Action callback)
Parameters
Type | Name | Description |
---|---|---|
int | actionId | The Action Identifier. |
string | displayText | The text to display inside the action's button. |
Action | callback | The callback invoked if the action is triggered. |
Events
dismissRequested
An event invoked when the user requests to dismiss the AlertDialog.
Declaration
public event Action<DismissType> dismissRequested
Event Type
Type | Description |
---|---|
Action<DismissType> |