Properties and Fields

Every Blazor component needs data - to store and display database queries, to capture the user input etc You can manage the fields and properties of your Blazor components or C# classes via Radzen Blazor Studio’s Data design mode.

To access Data design mode open a .razor or .cs file and click the corresponding button in the design canvas toolbar.

Radzen Blazor Studio will display a list of all fields and properties that are accessible from the current class / component.

Radzen Blazor Studio displays fields and properties that may be defined in other files - partial or classes.

Add property or field

To add a new property or field click the + button in the corresponding section. Then enter the name of the field / property, optional initial value and specify its type (Radzen Blazor Studio will try to infer the type automatically if you provide a value).

The value of the field / property must be a constant expression. For example you should not initialize your property or field by invoking an instance method. You can set the value later (for example in a life-cycle method).

Important: You should quote string values via " in this dialog.

Add a new field

If you have opened a Blazor component which is defined in multiple files (e.g. uses code-behind or partial classes) Radzen Blazor Studio will ask you to pick which file to add the new field / property to and then open that file.

Update property or field

Clicking a property or field would open a dialog which allows you to change its name, access, make it injectable or decorate it with the [Parameter] attribute. If the property or field is declared in a different file Radzen Blazor Studio will open that file automatically.

Important: Radzen Blazor Studio will not automatically change all occurrences of the property/name if you change its name.

Delete a property or field

To delete a property or field click the delete button (visible only if you have openend the file where the property or field is declared in).

Important: Your application may not build if you delete a property or field which is used somewhere else. Delete all usages beforehand.