Class InPlaceEditorEvents<TValue>
Configures the event handlers for the SfInPlaceEditor<TValue>.
Inheritance
Namespace: Syncfusion.Blazor.InPlaceEditor
Assembly: Syncfusion.Blazor.dll
Syntax
public class InPlaceEditorEvents<TValue> : OwningComponentBase
Type Parameters
Name | Description |
---|---|
TValue | Specifies the data type of the value being edited. |
Remarks
This component allows you to define and manage callbacks for various events triggered by the SfInPlaceEditor<TValue>, such as value changes, lifecycle events, and interaction events.
Examples
The following example demonstrates how to handle the ValueChange event to log the new value.
<SfInPlaceEditor @bind-Value="@EditorValue">
<InPlaceEditorEvents TValue="string" ValueChange="@OnValueChange"></InPlaceEditorEvents>
</SfInPlaceEditor>
@code {
private string EditorValue = "Initial Value";
private void OnValueChange(ChangeEventArgs<string> args)
{
Console.WriteLine($"The new value is: {args.Value}");
}
}
Constructors
InPlaceEditorEvents()
Declaration
public InPlaceEditorEvents()
Properties
BeginEdit
Gets or sets an event callback that triggers before the editor switches from its default state to edit mode.
Declaration
public EventCallback<BeginEditEventArgs> BeginEdit { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<BeginEditEventArgs> | An Microsoft.AspNetCore.Components.EventCallback<> that is invoked before entering edit mode. The callback receives BeginEditEventArgs. |
Remarks
This event allows you to execute code just before the editing UI is displayed. You can cancel the edit operation by setting e.Cancel = true
in the event handler.
Created
Gets or sets an event callback that triggers once the component has completed its rendering.
Declaration
public EventCallback<object> Created { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> | An Microsoft.AspNetCore.Components.EventCallback that is invoked after the component has been rendered. The default value is |
Remarks
This event is fired after the initial rendering of the component is complete, allowing you to perform actions that require the DOM to be fully loaded.
Destroyed
Gets or sets an event callback that triggers when the component is destroyed.
Declaration
public EventCallback<object> Destroyed { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> | An Microsoft.AspNetCore.Components.EventCallback that is invoked when the component is being removed from the DOM. The default value is |
Remarks
This event is useful for performing cleanup operations, such as disposing of resources that are not managed by the Blazor framework, just before the component is destroyed.
EndEdit
Gets or sets an event callback that triggers when the edit action is finished, before the new value is submitted or canceled.
Declaration
public EventCallback<EndEditEventArgs> EndEdit { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<EndEditEventArgs> | An Microsoft.AspNetCore.Components.EventCallback<> that is invoked when editing is complete. The callback receives EndEditEventArgs. |
Remarks
This event provides an opportunity to inspect the edited value before it is saved or discarded.
OnActionBegin
Gets or sets an event callback that triggers before data is submitted to the server.
Declaration
public EventCallback<ActionBeginEventArgs<TValue>> OnActionBegin { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ActionBeginEventArgs<TValue>> | An Microsoft.AspNetCore.Components.EventCallback<> that is invoked before the submission process begins. The callback receives ActionBeginEventArgs<TValue>, which can be used to cancel the action. |
Remarks
This event allows you to perform validation or other pre-submission logic. Set e.Cancel = true
within the event handler to prevent the data from being saved.
OnActionFailure
Gets or sets an event callback that triggers when data submission fails.
Declaration
public EventCallback<ActionEventArgs<TValue>> OnActionFailure { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ActionEventArgs<TValue>> | An Microsoft.AspNetCore.Components.EventCallback<> that is invoked upon a failed submission. The callback receives ActionEventArgs<TValue>. |
Remarks
This event is useful for implementing custom error handling logic, such as displaying a notification to the user when the save operation does not succeed.
OnActionSuccess
Gets or sets an event callback that triggers when data is successfully submitted to the server.
Declaration
public EventCallback<ActionEventArgs<TValue>> OnActionSuccess { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ActionEventArgs<TValue>> | An Microsoft.AspNetCore.Components.EventCallback<> that is invoked upon a successful submission. The callback receives ActionEventArgs<TValue>. |
Remarks
Use this event to perform actions after a successful save, such as refreshing related data or displaying a confirmation message.
ValueChange
Gets or sets an event callback that triggers when the value of the integrated component has changed.
Declaration
public EventCallback<ChangeEventArgs<TValue>> ValueChange { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ChangeEventArgs<TValue>> | An Microsoft.AspNetCore.Components.EventCallback<> that is invoked when the value changes. The callback receives ChangeEventArgs<TValue>. |
Remarks
This event is essential for tracking changes to the editor's value in real-time and updating the underlying data model accordingly.
It corresponds to the @bind-Value
functionality.
Methods
Dispose()
Releases all resources used by the InPlaceEditorEvents<TValue>.
Declaration
public virtual void Dispose()
Remarks
This method is the public entry point for disposing of the component and its resources.
Dispose(Boolean)
Releases the unmanaged resources used by the InPlaceEditorEvents<TValue> and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | A |
Remarks
When disposing
is true
, this method cleans up references to the parent component to prevent memory leaks.
OnInitializedAsync()
Method invoked when the component is ready to start.
Declaration
protected override Task OnInitializedAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous initialization process. |
Remarks
This method registers the event delegates with the parent SfInPlaceEditor<TValue>, enabling event handling.