Class DataSourceSettings
DataSourceSettings is used to specify the data source and defines how the parent and child relationship will be generated in the layout. It is applicable only when the layout is used.
Inherited Members
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public class DataSourceSettings : SfDataBoundComponent
Examples
<SfDiagramComponent Width = "1000px" Height="1000px">
<DataSourceSettings @bind-DataSource="@data" ID="@Id" ParentID="@ParentId" SymbolMapping="@doBinding"></DataSourceSettings>
<Layout Type = "LayoutType" >
</ Layout >
</ SfDiagramComponent >
@code {
public object data { get; set; }
public string Id;
public string ParentId;
public LayoutType LayoutType = LayoutType.HierarchicalTree;
protected override void OnInitialized()
{
Id = "Name";
ParentId = "Category";
data = Data1;
}
//bind the external data with the node
private Node doBinding(Node node, object data)
{
HierarchicalDetails hierarchicalData = data as HierarchicalDetails;
node.Annotations = new DiagramObjectCollection<ShapeAnnotation>()
{
new ShapeAnnotation()
{
ID = "annotation"+node.ID,
Content = hierarchicalData.Name,
},
};
return node;
}
public List<HierarchicalDetails> Data1 = new List<HierarchicalDetails>()
{
new HierarchicalDetails(){ Name ="Diagram",FillColor="#916DAF"},
new HierarchicalDetails(){ Name ="Layout", Category="Diagram"},
new HierarchicalDetails(){ Name ="Tree Layout",Category="Layout"},
new HierarchicalDetails(){ Name ="Organizational Chart", Category="Layout"}
};
public class HierarchicalDetails
{
public string Name { get; set; }
public string Category { get; set; }
public string FillColor { get; set; }
}
}
Constructors
DataSourceSettings()
Declaration
public DataSourceSettings()
Properties
ChildContent
Gets or sets the child content that the layout is displayed for.
Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.RenderFragment |
DataSource
Gets or sets the data source that the layout is displayed for.
Declaration
public object DataSource { get; set; }
Property Value
Type |
---|
System.Object |
Examples
<SfDiagramComponent Width = "1000px" Height="1000px">
<DataSourceSettings @bind-DataSource="@data" ID="@Id" ParentID="@ParentId" SymbolMapping="@doBinding"></DataSourceSettings>
<Layout Type = "LayoutType" >
</ Layout >
</ SfDiagramComponent >
@code {
public object data { get; set; }
public string Id;
public string ParentId;
public LayoutType LayoutType = LayoutType.HierarchicalTree;
protected override void OnInitialized()
{
Id = "Name";
ParentId = "Category";
data = Data1;
}
public List<HierarchicalDetails> Data1 = new List<HierarchicalDetails>()
{
new HierarchicalDetails(){ Name ="Diagram",FillColor="#916DAF"},
new HierarchicalDetails(){ Name ="Layout", Category="Diagram"},
new HierarchicalDetails(){ Name ="Tree Layout",Category="Layout"},
new HierarchicalDetails(){ Name ="Organizational Chart", Category="Layout"}
};
public class HierarchicalDetails
{
public string Name { get; set; }
public string Category { get; set; }
public string FillColor { get; set; }
}
}
DataSourceChanged
Specifies the callback to trigger when the data source changes.
Declaration
public EventCallback<object> DataSourceChanged { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
ID
Defines the property name that will be mapped to each node id from the data source record.
Declaration
public string ID { get; set; }
Property Value
Type |
---|
System.String |
Examples
<SfDiagramComponent Width = "1000px" Height="1000px">
<DataSourceSettings @bind-DataSource="@data" ID="@Id" ParentID="@ParentId" SymbolMapping="@doBinding"></DataSourceSettings>
<Layout Type = "LayoutType" >
</ Layout >
</ SfDiagramComponent >
@code {
public object data { get; set; }
public string Id;
public string ParentId;
public LayoutType LayoutType = LayoutType.HierarchicalTree;
protected override void OnInitialized()
{
Id = "Name";
ParentId = "Category";
data = Data1;
}
public List<HierarchicalDetails> Data1 = new List<HierarchicalDetails>()
{
new HierarchicalDetails(){ Name ="Diagram",FillColor="#916DAF"},
};
public class HierarchicalDetails
{
public string Name { get; set; }
public string Category { get; set; }
public string FillColor { get; set; }
}
}
IDChanged
Specifies the callback to trigger when the id value changes.
Declaration
public EventCallback<string> IDChanged { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.String> |
ParentID
Defines the property name that will be used to find the parent and child relationship between the nodes from the data source record.
Declaration
public string ParentID { get; set; }
Property Value
Type |
---|
System.String |
Examples
<SfDiagramComponent Width = "1000px" Height="1000px">
<DataSourceSettings @bind-DataSource="@data" ID="@Id" ParentID="@ParentId" SymbolMapping="@doBinding"></DataSourceSettings>
<Layout Type = "LayoutType" >
</ Layout >
</ SfDiagramComponent >
@code {
public object data { get; set; }
public string Id;
public string ParentId;
public LayoutType LayoutType = LayoutType.HierarchicalTree;
protected override void OnInitialized()
{
Id = "Name";
ParentId = "Category";
data = Data1;
}
public List<HierarchicalDetails> Data1 = new List<HierarchicalDetails>()
{
new HierarchicalDetails(){ Name ="Diagram",FillColor="#916DAF"},
new HierarchicalDetails(){ Name ="Layout", Category="Diagram"},
new HierarchicalDetails(){ Name ="Tree Layout",Category="Layout"},
new HierarchicalDetails(){ Name ="Organizational Chart", Category="Layout"}
};
public class HierarchicalDetails
{
public string Name { get; set; }
public string Category { get; set; }
public string FillColor { get; set; }
}
}
ParentIDChanged
Specifies the callback to trigger when the parent id value changes.
Declaration
public EventCallback<string> ParentIDChanged { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.String> |
Query
Gets or sets the query that is displayed for.
Declaration
public Query Query { get; set; }
Property Value
Type |
---|
Query |
Root
Gets or sets the root (primary) node of the layout populated from the data source.
Declaration
public string Root { get; set; }
Property Value
Type |
---|
System.String |
RootChanged
Specifies the callback to trigger when the root value changes.
Declaration
public EventCallback<string> RootChanged { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.String> |
SymbolBinding
Returns the customized node information. It is a call-back method which is triggered for each node when initializing the layout.
Declaration
public Func<Node, object, Node> SymbolBinding { get; set; }
Property Value
Type |
---|
System.Func<Node, System.Object, Node> |
Remarks
For more details, refer Organizational Chart |
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()
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. |
Overrides
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 representing any asynchronous operation. |
Overrides
OnParametersSetAsync()
Method invoked when any changes in component state occurs.
Declaration
protected override Task OnParametersSetAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Task |