Esempio n. 1
0
        public override Xwt.Widget Makeup(IXwtWrapper Parent)
        {
            Xwt.ColorSelector Target = new Xwt.ColorSelector()
            {
                SupportsAlpha = this.SupportsAlpha
            };
            if (this.Value != "")
                Target.Color = Xwt.Drawing.Color.FromName(this.Value);
            //Binding
            if (Source != "")
            {
                Target.Color = (Xwt.Drawing.Color)PathBind.GetValue(Source, Parent, Xwt.Drawing.Colors.White);
                Parent.PropertyChanged += (o, e) =>
                {
                    if (e.PropertyName == this.Source.Split('.')[0])
                        Xwt.Application.Invoke(() => Target.Color = (Xwt.Drawing.Color)PathBind.GetValue(Source, Parent, Xwt.Drawing.Colors.White));
                };
                Target.ColorChanged += (o, e) =>
                {
                    PathBind.SetValue(Source, Parent, Target.Color);
                };
            }

            WindowController.TryAttachEvent(Target, "ColorChanged", Parent, Changed);
            InitWidget(Target, Parent);
            return Target;
        }
Esempio n. 2
0
		public ColorSelectorSample ()
		{
			ColorSelector sel = new ColorSelector ();
			ColorPicker picker = new ColorPicker ();
			sel.Color = Xwt.Drawing.Colors.AliceBlue;
			picker.Color = Xwt.Drawing.Colors.AliceBlue;
			picker.Title = "Select a color";

			sel.SupportsAlpha = true;
			picker.SupportsAlpha = true;

			PackStart (sel);
			PackStart (new HSeparator());

			var pickerBox = new HBox ();
			pickerBox.PackStart (new Label("Or use a color picker:"));
			pickerBox.PackStart (picker);
			pickerBox.PackStart (new ColorPicker () { Style = ButtonStyle.Flat });
			pickerBox.PackStart (new ColorPicker () { Style = ButtonStyle.Borderless });
			PackStart (pickerBox);

			sel.ColorChanged += (sender, e) => picker.Color = sel.Color;
			picker.ColorChanged += (sender, e) => sel.Color = picker.Color;
		}
Esempio n. 3
0
		public ColorSelectorSample ()
		{
			ColorSelector sel = new ColorSelector ();
			sel.Color = Xwt.Drawing.Colors.AliceBlue;
			PackStart (sel);
		}