Наследование: Xwt.Widget
Пример #1
0
		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;
			};
		}
Пример #2
0
        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;
        }
Пример #3
0
		public DatePickerSample ()
		{
			var dp = new DatePicker ();
			PackStart (dp);

			Label la = new Label ();
			PackStart (la);
			dp.ValueChanged += delegate {
				la.Text = "Value changed: " + dp.DateTime;
			};
		}
Пример #4
0
        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();
        }