示例#1
0
 public Toggle(
     Binding <bool> value    = null,
     Action <bool> onChanged = null)
 {
     IsOn        = value;
     IsOnChanged = new MulticastAction <bool>(value, onChanged);
 }
示例#2
0
 public TextField(
     Binding <string> value           = null,
     string placeholder               = null,
     Action <string> onEditingChanged = null,
     Action <string> onCommit         = null)
 {
     Text             = value;
     Placeholder      = placeholder;
     OnEditingChanged = new MulticastAction <string>(Text, onEditingChanged);
     OnCommit         = onCommit;
 }
示例#3
0
 public Slider(
     Binding <float> value = null,
     float from            = 0,
     float through         = 100,
     float by = 1,
     Action <float> onEditingChanged = null)
 {
     Value            = value;
     From             = from;
     Through          = through;
     By               = by;
     OnEditingChanged = new MulticastAction <float>(Value, onEditingChanged);
 }
示例#4
0
 public Stepper(Binding <double> value         = null,
                Binding <double> maximumValue  = null,
                Binding <double> minimumValue  = null,
                Binding <double> increment     = null,
                Action <double> onValueChanged = null)
 {
     if (minimumValue >= maximumValue)
     {
         throw new ArgumentOutOfRangeException(nameof(minimumValue), "Minimum value is greater than the maximum value");
     }
     Value          = value;
     Maximum        = maximumValue;
     Minimum        = minimumValue;
     Increment      = increment;
     OnValueChanged = new MulticastAction <double>(value, onValueChanged);
 }
示例#5
0
 public Slider(
     Binding <float> value = null,
     float from            = 0,
     float through         = 100,
     float by = 1,
     Action <float> onEditingChanged = null)
 {
     Value = value ?? new Binding <float>(
         () => this.value ?? 50f,
         (outVal) => this.value = outVal
         );
     From             = from;
     Through          = through;
     By               = by;
     OnEditingChanged = new MulticastAction <float>(Value, onEditingChanged);
 }
示例#6
0
 public DatePicker(Binding <DateTime> date         = null,
                   Binding <DateTime> maximumDate  = null,
                   Binding <DateTime> minimumDate  = null,
                   Binding <string> format         = null,
                   Action <DateTime> onDateChnaged = null)
 {
     if (minimumDate?.CurrentValue >= maximumDate?.CurrentValue)
     {
         throw new ArgumentOutOfRangeException(nameof(minimumDate), "Minimum date is greater than the maximum date");
     }
     Date          = date;
     MaximumDate   = maximumDate;
     MinimumDate   = minimumDate;
     Format        = format;
     OnDateChanged = new MulticastAction <DateTime>(date, onDateChnaged);
 }
示例#7
0
 public TextField(
     Binding <string> value           = null,
     string placeholder               = null,
     Action <string> onEditingChanged = null,
     Action <string> onCommit         = null)
 {
     Text = value ?? new Binding <string>(
         () => this.value ??= "",
         (outVal) => this.value = outVal
         );
     Text.Set ??= (v) => {
         Text.BindingValueChanged(null, nameof(Text), v);
         this.ViewPropertyChanged(nameof(Text), v);
     };
     Placeholder      = placeholder;
     OnEditingChanged = new MulticastAction <string>(value, onEditingChanged);
     OnCommit         = onCommit;
 }