public CheckedValueEventArgs(CheckedValue checkedValue, int before, int current, CheckedValue.Action action, int valueWhichObjectTriedToPut) { CheckedValue = checkedValue ?? throw new ArgumentNullException(nameof(checkedValue)); Before = before; Current = current; Action = action; ValueWhichObjectTriedToPut = valueWhichObjectTriedToPut; }
internal override void MergeCheckBoxAttributes(TagBuilder tag, RenderContext context) { base.MergeCheckBoxAttributes(tag, context); if (CheckedValue == null) { throw new XamlException("The CheckedValue attribute is required for Radio"); } tag.MergeAttribute("value", CheckedValue.ToString()); }
private bool Checked() { if (CheckedValue == null) { if (Value == null) { return(true); } } else if (CheckedValue.Equals(Value)) { return(true); } return(false); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { position = EditorGUI.PrefixLabel(position, label); SerializedProperty current = property.FindPropertyRelative("_Current"); SerializedProperty min = property.FindPropertyRelative("_Min"); SerializedProperty max = property.FindPropertyRelative("_Max"); int minV = min.intValue; int maxV = max.intValue; position.width -= 4; float intFieldWidth = position.width * (2f / 9); float SliderWidth = position.width * (1f / 3); void Move() { position.x += position.width + 1; } int InitFieldAndMove(int val) { position.width = intFieldWidth; int res = EditorGUI.IntField(position, val); Move(); return(res); } int cur; cur = current.intValue; minV = InitFieldAndMove(minV); position.width = SliderWidth; cur = (int)GUI.HorizontalSlider(position, cur, minV, maxV); Move(); maxV = InitFieldAndMove(maxV); cur = (int)InitFieldAndMove(cur); if (minV >= maxV) { minV = maxV - 1; } min.intValue = minV; max.intValue = maxV; current.intValue = CheckedValue.CheckedGet(minV, maxV, cur);; }
internal override void MergeCheckBoxAttributes(TagBuilder tag, RenderContext context) { base.MergeCheckBoxAttributes(tag, context); var chv = GetBinding(nameof(CheckedValue)); if (chv != null) { tag.MergeAttribute(":value", chv.GetPathFormat(context)); } else if (CheckedValue != null) { tag.MergeAttribute("value", CheckedValue.ToString()); } else { throw new XamlException("The CheckedValue attribute is required for Radio"); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); PortalHelper.EnsureScriptManager(Page); // Initialize checkbox for special values if ((FieldInfo != null) && (FieldInfo.DataType != FormFieldDataTypeEnum.Boolean)) { if (CheckedValue == null) { CheckedValue = DataHelper.GetNotEmpty(GetValue("CheckedValue"), ""); } if (UncheckedValue == null) { UncheckedValue = DataHelper.GetNotEmpty(GetValue("UncheckedValue"), ""); } string innerValueString = ValidationHelper.GetString(innerValue, null); checkbox.Checked = CMSString.Equals(CheckedValue.ToString(), innerValueString); } }
/// <summary> /// Compares inner string value with checked value and sets the check box accordingly. /// </summary> private void HandleStringValue() { var innerValueString = ValidationHelper.GetString(mInnerValue, null); checkbox.Checked = CMSString.Equals(CheckedValue.ToString(), innerValueString); }
/// <inheritdoc/> public override async Task SetParametersAsync(ParameterView parameters) { if (parameters.TryGetValue <TValue>(nameof(CheckedValue), out var result) && !CheckedValue.IsEqual(result)) { await CurrentValueHandler(result?.ToString()); } await base.SetParametersAsync(parameters); if (ParentValidation != null) { if (parameters.TryGetValue <Expression <Func <TValue> > >(nameof(CheckedValueExpression), out var expression)) { await ParentValidation.InitializeInputExpression(expression); } await InitializeValidation(); } }