Class DiagramHistoryManager
Notifies when changes are reverted or restored.
Inheritance
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public class DiagramHistoryManager : ComponentBase
Constructors
DiagramHistoryManager()
Initializes a new instance of the DiagramHistoryManager class.
Declaration
public DiagramHistoryManager()
Properties
CanRedo
Decides whether the history entry can be redo.
Declaration
public bool CanRedo { get; set; }
Property Value
Type |
---|
System.Boolean |
CanUndo
Decides whether the history entry can be undo.
Declaration
public bool CanUndo { get; set; }
Property Value
Type |
---|
System.Boolean |
ChildContent
Gets or Sets the child content for history manager
Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.RenderFragment |
CurrentEntry
Specifies the current entry object.
Declaration
public HistoryEntryBase CurrentEntry { get; set; }
Property Value
Type |
---|
HistoryEntryBase |
HistoryAdding
Decides whether the changes are stored in the history or not.
Declaration
public EventCallback<HistoryAddingEventArgs> HistoryAdding { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<HistoryAddingEventArgs> |
Examples
<SfDiagramComponent Width="800px" Height="800px">
<DiagramHistoryManager HistoryAdding="OnHistoryAdding"></DiagramHistoryManager>
</SfDiagramComponent>
@code
{
private void OnHistoryAdding(HistoryAddingEventArgs args)
{
args.Cancel = true;
}
}
Redo
The method will be called when the custom entry is in the redo stage.
Declaration
public EventCallback<HistoryEntryBase> Redo { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<HistoryEntryBase> |
Examples
<SfDiagramComponent Width="800px" Height="800px">
<DiagramHistoryManager Redo="onCustomRedo"></DiagramHistoryManager>
</SfDiagramComponent>
@code
{
private void onCustomRedo(HistoryEntryBase entry)
{
Node current = entry.UndoObject.Clone() as Node;
(entry.UndoObject as Node).AdditionalInfo[(entry.UndoObject as Node).ID] = "Description";
entry.RedoObject = current;
}
}
StackLimit
Gets or sets the number of history entries that can be stored on the history list to limit undo, redo stack.
Declaration
public int StackLimit { get; set; }
Property Value
Type |
---|
System.Int32 |
Examples
<SfDiagramComponent Height="900px">
<DiagramHistoryManager StackLimit="@stack" ></DiagramHistoryManager>
</SfDiagramComponent>
Undo
The method will be called when the custom entry is in undo stage.
Declaration
public EventCallback<HistoryEntryBase> Undo { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<HistoryEntryBase> |
Examples
<SfDiagramComponent Width="800px" Height="800px">
<DiagramHistoryManager Undo="onCustomUndo"></DiagramHistoryManager>
</SfDiagramComponent >
@code
{
private void onCustomUndo(HistoryEntryBase entry)
{
(entry.RedoObject) = entry.UndoObject.Clone() as Node;
(entry.UndoObject as Node).AdditionalInfo[(entry.UndoObject as Node).ID] = "Start";
}
}
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
Dispose()
This method releasing all unmanaged resources.
Declaration
public void Dispose()
EndGroupAction()
Used to intimate the group action is end
Declaration
public void EndGroupAction()
Examples
//End the grouping of changes
diagram.EndGroupAction();
OnAfterRenderAsync(Boolean)
Method invoked after each time the component has been rendered.
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | firstRender | Set to true for the first time component rendering, otherwise gets false. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing any asynchronous operation. |
OnInitializedAsync()
This method is invoked when the component is ready to start.
Declaration
protected override Task OnInitializedAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
OnParametersSetAsync()
Method invoked when any changes in component state occur.
Declaration
protected override Task OnParametersSetAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | ="Task". |
StartGroupAction()
History allows you to revert or restore multiple changes through a single undo/redo command. It is used to start the grouping of changes.
Declaration
public void StartGroupAction()
Examples
//Start the grouping of changes
diagram.StartGroupAction();