Files
Daybreak/Daybreak.Core/Views/Components/Options/BooleanOption.razor
T

26 lines
805 B
Plaintext

<div class="option-display-box">
<div class="option-content">
<div class="option-title">@this.Name</div>
<div class="option-description">@this.Description</div>
</div>
<div class="option-control-with-label">
<FluentLabel class="label">@(this.Value ? "On" : "Off")</FluentLabel>
<FluentSwitch @bind-Value="this.Value" @bind-Value:after="this.OnToggleChanged" />
</div>
</div>
@inherits OptionBase<bool>
@code{
protected override bool ConvertValue(OptionInstance optionInstance, OptionProperty property)
{
var value = property.Getter(optionInstance) as bool?;
return value ?? false;
}
private void OnToggleChanged()
{
this.Property.Setter(this.Instance, this.Value);
this.NotifyValueChanged();
}
}