- Solution Name: BlazorControlDemo
- Software Version: v10 Update 1d
- Keywords: BlazorControl
Summary
This example demonstrates how to use an external BlazorControl component on any HTML5 display of your solutions.
Technical Information
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).
- On the Components Panel, select Viewer, then BlazorCtrl(Web).
Click or drag-and-drop it on the Drawing area to use it.
- Once you drop it, a File Explorer will open, here you must choose the control DLL file that will be used.
Select the file "BlazorControlExample.dll" and click Open
- Choose the ProgressBar from the selected DLL and press OK, then click on the display to insert your control.
- Double-click your control and configure the required fields like this:
- Control name: ProgressBar
- Assembly: BlazorControlExample.dll
- Type: BlazorControlExample.ProgressBar
- Create the required tags for this demo:
- Barcolor = Text
- TargetProduction= Integer
- CurrentProduction = Integer
- In the CodeBehind
- Select the BlazorControl from the View Elements on left side Panel on the Drawing environment.
- Select the DLL with the control. In order to enable the web distribution, put that control is the foder BlazorControls in the product distribution folder.
- Setup the settings in the configuration dialog with components references.
- In the Code Behind, bind properties of the external control with Tags in your application.
CodeBehind
In the CodeBehind, change the code to match with this:
Code Block | ||||
---|---|---|---|---|
| ||||
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.
Reference Information
→ See BlazorControls User Guide > Draw > Components > BlazorControl for more information.
In this section:
Page Tree | ||||
---|---|---|---|---|
|