blazor child component to parent. code example
Example 1: how to pass property between blazor components
using System;
namespace AppDataService.Services
{
public class AppData
{
private int _number;
public int Number
{
get
{
return _number;
}
set
{
_number = value;
NotifyDataChanged();
}
}
private string _color;
public string Color
{
get
{
return _color;
}
set
{
_color = value;
NotifyDataChanged();
}
}
public event Action OnChange;
private void NotifyDataChanged() => OnChange?.Invoke();
}
}
Example 2: how to pass property between blazor components
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<Services.AppData>();
}