@namespace Oqtane.Modules.Controls @inherits ModuleControlBase @code { private bool? _value = null; private string _title; private string _src = string.Empty; [Parameter] public bool? Value { get; set; } [Parameter] public bool Disabled { get; set; } [Parameter] public Action OnChange { get; set; } protected override void OnInitialized() { _value = Value; SetImage(); } private void SetValue() { if (!Disabled) { switch (_value) { case true: _value = false; break; case false: _value = null; break; case null: _value = true; break; } SetImage(); OnChange(_value); } } private void SetImage() { switch (_value) { case true: _src = "images/checked.png"; _title = "Permission Granted"; break; case false: _src = "images/unchecked.png"; _title = "Permission Denied"; break; case null: _src = "images/null.png"; _title = string.Empty; break; } StateHasChanged(); } }