Download the solution Blazor Control Example.dbsln. This example demonstrates how to use an external BlazorControl component on any HTML5 display of your solutions. |
The example demonstrates how to use the BlazorControl enhancing the display with custom styles and interactive functionalities.
Step-by-Step:
Go to Displays / Draw (it is important to remember that BlazorControls only are available for HTML5 displays).
Click or drag-and-drop it on the Drawing area to use it.
Select the file "BlazorControlExample.dll" and click Open
In the CodeBehind, change the code to match with this:
public async Task BlazorControlLoaded(TBlazorControl control)
{
//This event will be triggered for each Blazor Control in the display.
//Using the TBlazorControl to access the desired Blazor control ProgressBar
BlazorControlExample.ProgressBar myProgressBarComponent = control.BlazorComponent as BlazorControlExample.ProgressBar;
myProgressBarComponent.CurrentProduction = 150;
//The BindEvent can be used to bind bi-directional Tags to Blazor properties. It requires an EventCallback on the Blazor control to receive the value back into the Tag.
control.BindEvent("CurrentProduction", @Tag.CurrentProduction.GetName(), "CurrentProductionRestarted");
//Using "null" in the third property of the BindEvent function will set the Tag into the property in a one way, so the tag will only send values to the control, it will never receive values back.
control.BindEvent("TargetProduction", @Tag.TargetProduction.GetName(), null);
control.BindEvent("BarColor", @Tag.BarColor.GetName(), null);
}
|
Once it is done, the project is ready to Start and the tags are linked properly to the control.
