Add Input

This commit is contained in:
Frank A. Krueger 2017-06-15 22:33:12 -07:00
parent 10b2a55df1
commit c6387c4070
2 changed files with 98 additions and 0 deletions

View File

@ -10,6 +10,12 @@ namespace Ooui
set => SetProperty (ref name, value, "name"); set => SetProperty (ref name, value, "name");
} }
bool isDisabled = false;
public bool IsDisabled {
get => isDisabled;
set => SetProperty (ref isDisabled, value, "disabled");
}
public FormControl (string tagName) public FormControl (string tagName)
: base (tagName) : base (tagName)
{ {

92
Ooui/Input.cs Normal file
View File

@ -0,0 +1,92 @@
using System;
namespace Ooui
{
public class Input : FormControl
{
InputType typ = InputType.Text;
public InputType Type {
get => typ;
set => SetProperty (ref typ, value, "type");
}
string val = "";
public string Value {
get => val;
set => SetProperty (ref val, value ?? "", "value");
}
public double NumberValue {
get {
double v;
double.TryParse (Value, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.CurrentUICulture, out v);
return v;
}
set {
Value = value.ToString (System.Globalization.CultureInfo.CurrentUICulture);
}
}
bool isChecked = false;
public bool IsChecked {
get => isChecked;
set => SetProperty (ref isChecked, value, "checked");
}
double minimum = 0;
public double Minimum {
get => minimum;
set => SetProperty (ref minimum, value, "min");
}
double maximum = 100;
public double Maximum {
get => maximum;
set => SetProperty (ref maximum, value, "max");
}
double step = 100;
public double Step {
get => step;
set => SetProperty (ref step, value, "step");
}
public Input ()
: base ("input")
{
}
public Input (InputType type)
: this ()
{
Type = type;
}
}
public enum InputType
{
Text,
Date,
Week,
Datetime,
DatetimeLocal,
Time,
Month,
Range,
Number,
Hidden,
Search,
Email,
Tel,
Url,
Password,
Color,
Checkbox,
Radio,
File,
Submit,
Reset,
Image,
Button,
}
}