Class DiagramObjectCollection<T>
Represents a dynamic data collection that provides notifications when nodes or connectors or annotations or ports are added, removed, or when the whole list is refreshed.
Inheritance
System.Object
DiagramObjectCollection<T>
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public class DiagramObjectCollection<T> : ObservableCollection<T>
Type Parameters
Name | Description |
---|---|
T | T |
Constructors
DiagramObjectCollection()
Initializes a new instance of the HistoryEntry class.
Declaration
public DiagramObjectCollection()
DiagramObjectCollection(IEnumerable<T>)
Creates a new instance of the DiagramObjectCollection from the given DiagramObjectCollection.
Declaration
public DiagramObjectCollection(IEnumerable<T> collection)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | collection | DiagramObjectCollection |
Methods
AddAsync(T)
Add the objects to the diagram object collection asynchronously. It is applicable only to ports and annotations.
Declaration
public Task AddAsync(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | It contain which item needs to be add |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Diagram Object |
Examples
//Method for adding labels at runtime
public async void AddLabel()
{
ShapeAnnotation annotation = new ShapeAnnotation { Content = "Annotation" };
await (diagram.Nodes[0].Annotations as DiagramObjectCollection<ShapeAnnotation>).AddAsync(annotation);
}
ClearItems()
Removes all the elements from the diagram object collection.
Declaration
protected override void ClearItems()