Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Is there a Blazor equivalent to WinForm's PropertyGrid?

$
0
0

I have a long overdue UI upgrade for a WinForms application and am going to make it a Blazor app. The legacy app configuration is made using WinForm's PropertGrid. Is there an equivalent Blazor component or best practice for converting a settings class into a Blazor form?

e.g.

class MySettings{public string Name {get;set;}public int Age {get;set;}public string Address {get;set;}// 1000 other settings of int, string, enums etc}

Is there a way to render MySettings into a nice Blazor form, or a Blazor component that can be used without designing the form in a Razor page with thousands of inputs binded to each property in MySettings.

This is the long form way of doing it with validation:

<EditForm Model="@_mySettingsModel" OnValidSubmit="HandleValidSubmit"><DataAnnotationsValidator /><ValidationSummary /><InputText id="name" @bind-Value="_mySettingsModel.Name" /><InputText id="age" @bind-Value="_mySettingsModel.Age" /><InputText id="address" @bind-Value="_mySettingsModel.Address" /><button type="submit">Submit</button></EditForm>@code {    private MySettings _mySettingsModel = new MySettings();    private void HandleValidSubmit()    {        Console.WriteLine("Saving Settings...");    }}

Reference: https://learn.microsoft.com/en-us/aspnet/core/blazor/forms-validation?view=aspnetcore-3.1


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>