public DatePickerSample () { var dtp = new DatePicker (DateTime.Now); PackStart (dtp); Label la1 = new Label ("Initial Value: " + dtp.DateTime); PackStart (la1); dtp.ValueChanged += delegate { la1.Text = "Value changed: " + dtp.DateTime; }; var dp = new DatePicker (DatePickerStyle.Date); PackStart (dp); Label la2 = new Label ("Initial Value: " + dp.DateTime); PackStart (la2); dp.ValueChanged += delegate { la2.Text = "Value changed: " + dp.DateTime; }; var tp = new DatePicker (DatePickerStyle.Time, DateTime.MinValue); PackStart (tp); Label la3 = new Label ("Initial Value: " + tp.DateTime); PackStart (la3); tp.ValueChanged += delegate { la3.Text = "Value changed: " + tp.DateTime; }; }
public override Xwt.Widget Makeup(IXwtWrapper Parent) { Xwt.DatePicker Target = new Xwt.DatePicker() { Style = this.Style }; if (this.Value != "") { try { DateTime Val = DateTime.Parse(Value); Target.DateTime = Val; } catch { } } //Binding if (Source != "") { Target.DateTime = (DateTime)PathBind.GetValue(Source, Parent, DateTime.Now); Parent.PropertyChanged += (o, e) => { if (e.PropertyName == this.Source.Split('.')[0]) Xwt.Application.Invoke(() => Target.DateTime = (DateTime)PathBind.GetValue(Source, Parent, DateTime.Now)); }; Target.ValueChanged += (o, e) => { PathBind.SetValue(Source, Parent, Target.DateTime); }; } WindowController.TryAttachEvent(Target, "ValueChanged", Parent, Changed); InitWidget(Target, Parent); return Target; }
public DatePickerSample () { var dp = new DatePicker (); PackStart (dp); Label la = new Label (); PackStart (la); dp.ValueChanged += delegate { la.Text = "Value changed: " + dp.DateTime; }; }
public DatePicker() { var picker = new Xwt.DatePicker(); picker.Style = DatePickerStyle.Date; picker.DateTime = DateTime.Now; var widget = (Gtk.Widget)Xwt.Toolkit.CurrentEngine.GetNativeWidget(picker); Add(widget); ShowAll(); }