Class BaseComponent
A Base Component for all the Syncfusion Blazor UI components.
Inherited Members
Namespace: Syncfusion.Blazor
Assembly: Syncfusion.Blazor.dll
Syntax
public abstract class BaseComponent : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Constructors
BaseComponent()
Declaration
protected BaseComponent()
Properties
DotNetObjectRef
Gets or sets the .NET object reference for JavaScript interop callbacks.
Declaration
protected DotNetObjectReference<object>? DotNetObjectRef { get; set; }
Property Value
| Type |
|---|
| DotNetObjectReference<object> |
EditContext
Gets or sets the edit context for form validation.
Declaration
[JsonIgnore]
[CascadingParameter]
protected EditContext? EditContext { get; set; }
Property Value
| Type |
|---|
| EditContext |
InteropNamespace
Gets or sets the JavaScript namespace for the component.
Declaration
protected virtual string? InteropNamespace { get; set; }
Property Value
| Type |
|---|
| string |
UniqueIdenfier
Gets or sets the unique identifier for the adaptor instance.
Declaration
protected int UniqueIdenfier { get; set; }
Property Value
| Type |
|---|
| int |
jsProperty
Gets or sets the JavaScript property name for the component.
Declaration
protected virtual string? jsProperty { get; set; }
Property Value
| Type |
|---|
| string |
jsRuntime
Gets or sets the JavaScript runtime instance for interop operations.
Declaration
[Inject]
protected IJSRuntime? jsRuntime { get; set; }
Property Value
| Type |
|---|
| IJSRuntime |
mainParent
Gets or sets the main parent component reference.
Declaration
protected virtual BaseComponent? mainParent { get; set; }
Property Value
| Type |
|---|
| BaseComponent |
Methods
CreateJsAdaptor()
Creates a JavaScript interop adaptor for the component.
Declaration
protected virtual JSInteropAdaptor CreateJsAdaptor()
Returns
| Type | Description |
|---|---|
| JSInteropAdaptor | A JSInteropAdaptor instance. |
Dispose()
Releases all resources used by the component, including JavaScript interop objects and event handlers.
Declaration
public virtual void Dispose()
GetDataManagers(object, string?)
Gets or creates a DataManager instance for the specified data source.
Declaration
protected object GetDataManagers(object dataSource, string? key = null)
Parameters
| Type | Name | Description |
|---|---|---|
| object | dataSource | The data source to wrap in a DataManager. Can be an existing DataManager, SfDataManager, or an enumerable collection. |
| string | key | Optional key to identify the DataManager in the parent component's DataManagerContainer. |
Returns
| Type | Description |
|---|---|
| object | A DefaultAdaptor instance configured with the DataManager for the data source. |
OnAfterRenderAsync(bool)
Invoked after each render of the component.
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | firstRender | True if this is the first time the component has rendered; otherwise, false. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous render operation. |
Overrides
OnInitializedAsync()
Initializes the component asynchronously after it has been created.
Declaration
protected override Task OnInitializedAsync()
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous initialization operation. |
Overrides
Refresh()
Refreshes the component by invoking the refresh method on the client-side JavaScript instance.
Declaration
public void Refresh()
WireObservableEvents(object)
Wires up event handlers for observable collections and property change notifications.
Declaration
protected virtual void WireObservableEvents(object collection)
Parameters
| Type | Name | Description |
|---|---|---|
| object | collection | The collection to monitor for changes. Must implement INotifyCollectionChanged or INotifyPropertyChanged. |
clearClientChanges(bool)
Clears client-side property changes from the bindable properties collection.
Declaration
protected void clearClientChanges(bool clearBindables = false)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | clearBindables | If true, clears bindable properties regardless of client change state; otherwise, clears only when client changes are pending and data binding is not active. |
getSerializedModel()
Serializes the component model to a JSON string representation.
Declaration
protected virtual string getSerializedModel()
Returns
| Type | Description |
|---|---|
| string | A JSON string containing the serialized component state. |
getUpdateModel(bool)
Gets the serialized component model for JavaScript interop updates.
Declaration
protected virtual string getUpdateModel(bool isInit = false)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | isInit | If true, returns the full serialized model merged with bindable properties for initialization; otherwise, returns only the bindable properties. |
Returns
| Type | Description |
|---|---|
| string | A JSON string containing either the complete component state with bindable properties (when isInit is true) or only the bindable properties (when isInit is false). |