Class DialogButtons
Represents a collection of DialogButton components that are rendered within the SfDialog component.
Inheritance
Namespace: Syncfusion.Blazor.Popups
Assembly: Syncfusion.Blazor.dll
Syntax
public class DialogButtons : OwningComponentBase
Remarks
The DialogButtons component serves as a container for multiple DialogButton instances within a dialog.
To generate dynamic DialogButton instances based on a collection, use @foreach
within the DialogButtons tag directive.
Each button in the collection can be configured with different properties such as content, click handlers, and styling options.
Examples
In the following code example, a basic dialog with buttons has been rendered using the tag directive.
@using Syncfusion.Blazor.Popups
<SfDialog Width="500px" @bind-Visible="Visibility">
<DialogTemplates>
<Content>
<p>
Dialog content
</p>
</Content>
</DialogTemplates>
<DialogButtons>
<DialogButton IsPrimary="true" Content="Ok" OnClick="@OnBtnClick" />
<DialogButton Content="Cancel" OnClick="@OnBtnClick" />
</DialogButtons>
</SfDialog>
@code {
private bool Visibility { get; set; } = true;
private void OnBtnClick()
{
this.Visibility = false;
}
}
Constructors
DialogButtons()
Declaration
public DialogButtons()
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
Dispose()
Releases all resources used by the DialogButtons component.
Declaration
public virtual void Dispose()
Remarks
This method performs cleanup operations by calling the protected Dispose(Boolean) method with true
as parameter.
It clears the button collection and releases all managed resources associated with the component.
Dispose(Boolean)
Releases the unmanaged resources used by the DialogButtons component and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
|
Remarks
When disposing
is true
, this method clears the button collection, nullifies the child content,
and removes the reference to the parent dialog component to prevent memory leaks.
This method is called by the public Dispose() method and the finalizer.