private static UICheckBox AddCheckbox <T>(this UIHelperBase group, string text, string propertyName, CheckboxAttribute attr) { var property = typeof(T).GetProperty(propertyName); return((UICheckBox)group.AddCheckbox(text, (bool)property.GetValue(OptionsWrapper <T> .Options, null), b => { property.SetValue(OptionsWrapper <T> .Options, b, null); OptionsWrapper <T> .SaveOptions(); attr.Action <bool>().Invoke(b); })); }