Component Parameters
Component Parameters is a way to share data between parent and child components
class CustomParameter
{
public int Numeric { get; set; }
}
partial class ParametersPage: Component
{
[Param]
IParameter<CustomParameter> _customParameter;
public override VisualNode Render()
=> ContentPage("Parameters Sample",
=> VStack(spacing: 10,
Button("Increment from parent", () => _customParameter.Set(_=>_.Numeric += 1 )),
Label(_customParameter.Value.Numeric),
new ParameterChildComponent()
)
.Center()
);
}Last updated