Exemple #1
0
		Control MessageBoxTypeCombo()
		{
			var control = new EnumDropDown<MessageBoxType>();
			var binding = new BindableBinding<MessageBoxSection, MessageBoxType>(this, r => r.MessageBoxType, (r, val) => r.MessageBoxType = val);
			control.SelectedValueBinding.Bind(binding);
			return control;
		}
Exemple #2
0
 internal static ICastItems <T> CastItems <T, TFrom>(this BindableBinding <T, IEnumerable <TFrom> > binding)
     where T : Eto.Forms.IBindable
 {
     return(new CastItemsHelper <T, TFrom> {
         Binding = binding
     });
 }
Exemple #3
0
		Control TitleBox()
		{
			var control = new TextArea { Size = new Size(300, -1) };
			var binding = new BindableBinding<MessageBoxSection, string>(this, r => r.MessageBoxText, (r, val) => r.MessageBoxText = val);
			control.TextBinding.Bind(binding);
			return control;
		}
        Control MessageBoxDefaultButtonCombo()
        {
            var control = new EnumDropDown <MessageBoxDefaultButton>();
            var binding = new BindableBinding <MessageBoxSection, MessageBoxDefaultButton>(this, r => r.MessageBoxDefaultButton, (r, val) => r.MessageBoxDefaultButton = val);

            control.SelectedValueBinding.Bind(binding);
            return(control);
        }
Exemple #5
0
 public BooleanCommand()
 {
     CheckedBinding = new BindableBinding <BooleanCommand, bool?>(
         this,
         (c) => c.Checked,
         (c, v) => c.Checked         = v ?? false,
         (c, h) => c.CheckedChanged += h,
         (c, h) => c.CheckedChanged -= h
         );
 }
        Control TitleBox()
        {
            var control = new TextArea {
                Size = new Size(300, -1)
            };
            var binding = new BindableBinding <MessageBoxSection, string>(this, r => r.MessageBoxText, (r, val) => r.MessageBoxText = val);

            control.TextBinding.Bind(binding);
            return(control);
        }
        Control AttachToParentCheckBox()
        {
            var control = new CheckBox {
                Text = "Attach to Parent Window"
            };
            var binding = new BindableBinding <MessageBoxSection, bool?>(this, r => r.AttachToParent, (r, val) => r.AttachToParent = val ?? false);

            control.CheckedBinding.Bind(binding);
            return(control);
        }
Exemple #8
0
        public static void AddTimeSpanConvBinding <TValue, T1>(this BindableBinding <T1, string> binding, Expression <Func <TValue, TimeSpan> > property)
            where T1 : IBindable
        {
            string convFromTs(TimeSpan ts) => ts.ToShortTimeString();

            TimeSpan convToTs(string s)
            {
                TimeSpan.TryParse(s.Replace("24:", "1.00:"), out var ts);
                return(ts);
            };

            binding.Convert(convToTs, convFromTs).BindDataContext(property);
        }
Exemple #9
0
        public static void AddFloatConvBinding <TValue, T1>(this BindableBinding <T1, string> binding, Expression <Func <TValue, float> > property)
            where T1 : IBindable
        {
            var shadowBinding = Binding.Property(property);

            binding.BindDataContext <TValue>(s => shadowBinding.GetValue(s).ToString(), (s, str) =>
            {
                if (float.TryParse(str, out float i))
                {
                    shadowBinding.SetValue(s, i);
                }
            });
        }
Exemple #10
0
		Control AttachToParentCheckBox()
		{
			var control = new CheckBox { Text = "Attach to Parent Window" };
			var binding = new BindableBinding<MessageBoxSection, bool?>(this, r => r.AttachToParent, (r, val) => r.AttachToParent = val ?? false);
			control.CheckedBinding.Bind(binding);
			return control;
		}