Class DialogAnimationSettings
A class used for configuring the animation properties in the SfDialog component.
Inheritance
Namespace: Syncfusion.Blazor.Popups
Assembly: Syncfusion.Blazor.dll
Syntax
public class DialogAnimationSettings : OwningComponentBase
Remarks
The DialogAnimationSettings class allows you to customize the animation behavior when opening and closing dialogs. You can configure properties such as delay, duration, and animation effects to create smooth transitions and enhance user experience. The animation settings are applied uniformly to both the show and hide operations of the dialog.
Examples
In the following example, change the animation effect and delay time while opening the dialog.
@using Syncfusion.Blazor.Popups
<SfDialog Width="500px" @bind-Visible="Visibility">
<DialogTemplates>
<Content>
<p>
Dialog content
</p>
</Content>
</DialogTemplates>
<DialogAnimationSettings Delay="400" Effect="DialogEffect.SlideTop">
</DialogAnimationSettings>
</SfDialog>
@code {
private bool Visibility { get; set; } = true;
}
Constructors
DialogAnimationSettings()
Declaration
public DialogAnimationSettings()
Properties
Delay
Gets or sets the delay in milliseconds before the animation begins.
Declaration
public double Delay { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A numeric value representing the delay time in milliseconds before the animation starts. The default value is |
Remarks
The delay setting affects both opening and closing animations of the dialog. A higher delay value will create a longer pause before the animation begins. This can be useful for creating staggered effects or synchronizing animations with other UI elements.
Duration
Gets or sets the duration in milliseconds that the animation takes to open or close the SfDialog.
Declaration
public double Duration { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A numeric value representing the time in milliseconds for the animation to complete. The default value is |
Remarks
The duration controls how fast or slow the animation plays. A shorter duration creates faster animations, while a longer
duration creates slower, more gradual transitions. The same duration is used for both opening and closing animations.
Setting this to 0
will effectively disable the animation transition.
Effect
Gets or sets the animation effect that should be used when opening and closing the SfDialog.
Declaration
public DialogEffect Effect { get; set; }
Property Value
Type | Description |
---|---|
DialogEffect | A DialogEffect enumeration value that specifies the animation effect. The default value is Fade. The available animation effects are:
|
Remarks
The animation effect determines the visual transition style when the dialog appears or disappears. Each effect has both an opening and closing variation - for example, Fade will use 'FadeIn' when opening and 'FadeOut' when closing. The slide effects will animate from/to the specified direction. Setting this to None will disable animations entirely.
Methods
Dispose()
Releases all resources used by the DialogAnimationSettings component.
Declaration
public virtual void Dispose()
Remarks
This method implements the System.IDisposable pattern and should be called when the component is no longer needed to ensure proper cleanup of resources and references. It automatically calls the protected Dispose(Boolean) method.
Dispose(Boolean)
Releases the unmanaged resources used by the DialogAnimationSettings and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
|
Remarks
This method is called by the public Dispose() method and the finalizer. When disposing
is true
,
this method releases all resources held by managed objects that this DialogAnimationSettings references.
It clears the reference to the parent dialog component to prevent memory leaks.
OnInitializedAsync()
Method invoked when the component is ready to start, called once the component has been initialized.
Declaration
protected override Task OnInitializedAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
This method is part of the Blazor component lifecycle and is called after the component has been constructed and its initial parameters have been set. It registers this animation settings instance with its parent SfDialog component to ensure the animation configuration is properly applied.
OnParametersSetAsync()
Method invoked when the component has received parameters from its parent and parameter values have changed.
Declaration
protected override Task OnParametersSetAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
This method is called whenever the component's parameters change after initialization. It detects changes in the animation properties (Delay, Duration, and Effect) and updates the dialog's animation configuration accordingly. If the parent dialog is already rendered, it will immediately apply the new animation settings through JavaScript interop to ensure the changes take effect without requiring a full re-render.