protected internal void Add(Binding binding)
 {
     CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, binding);
     this.OnCollectionChanging(e);
     this.AddCore(binding);
     this.OnCollectionChanged(e);
 }
コード例 #2
0
		protected virtual void AddCore (Binding dataBinding) 
		{
			CollectionChangeEventArgs args = new CollectionChangeEventArgs (CollectionChangeAction.Add, dataBinding);
			OnCollectionChanging (args);
			base.List.Add(dataBinding);
			OnCollectionChanged (args);
		}
コード例 #3
0
ファイル: NumericBinder.cs プロジェクト: kanbang/Colt
        // We need to force WriteValue() on CheckedChanged otherwise it will only call WriteValue()
        // on loss of focus.
        // http://stackoverflow.com/questions/1060080/databound-winforms-control-does-not-recognize-change-until-losing-focus
        /// <summary>
        /// Binds the specified NumericUpDown control
        /// </summary>
        /// <param name="num"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static Binding BindValueChanged(NumericUpDown num, Binding b)
        {
            num.DataBindings.Add(b);
            num.ValueChanged += (sender, e) => { b.WriteValue(); };

            return b;
        }
コード例 #4
0
ファイル: BoundLabel.cs プロジェクト: heimanhon/researchwork
    public void Bind(object model_, string propertyOnModel_, Validators.IValidator validator_, bool colourNegRed_)
    {
      System.Windows.Forms.Binding binding;

      binding = new System.Windows.Forms.Binding("Text", model_, propertyOnModel_, validator_ != null, DataSourceUpdateMode.OnPropertyChanged);

      if (validator_ != null)
      {
        binding.Parse += new ConvertEventHandler(validator_.Parse);
        binding.Format += new ConvertEventHandler(validator_.Format);

        if (colourNegRed_ && validator_ is Validators.ISignChanged)
        {
          UseAppStyling = false;
          m_validator = validator_;
          ForeColor = System.Drawing.Color.Red;
          ((Validators.ISignChanged)validator_).SignChanged += handleSignChanged;
          ((Validators.ISignChanged)validator_).FireOnSignChanged();
        }
      }

      if (DataBindings["Text"] != null)
        DataBindings.Remove(DataBindings["Text"]);

      DataBindings.Add(binding);
    }
コード例 #5
0
        private void build(int row, int col)
        {
            string id = row.ToString() + col.ToString();
            int x = INIT_HORZ_PADDING + (UPDOWN_SIZE.Width + LBL_SIZE.Width + HORZ_PADDING) * col;
            int y = INIT_VERT_PADDING + (Math.Max(UPDOWN_SIZE.Height, LBL_SIZE.Width) + VERT_PADDING) * row;

            GenotypeCount data = (GenotypeCount)_dataBS.DataSource;
            bool isHomo = data.Genotype.IsHomozygous;

            // Initialize the Label
            _label = new Label() {
                Name = $"{(isHomo ? "H**o" : "Hetero")}CountLbl{id}",
                Location = new Point(x, y + LBL_OFFSET),
                AutoSize = false,
                Size = LBL_SIZE,
            };
            Binding lblBinding = new Binding("Text", _dataBS, "Genotype.Alleles", true, DataSourceUpdateMode.Never);
            lblBinding.Format += LblBinding_Format;
            _label.DataBindings.Add(lblBinding);

            // Initialize the NumericUpDown
            _upDown = new NumericUpDown() {
                Name = $"{(isHomo ? "H**o" : "Hetero")}CountUpDown{id}",
                Location = new Point(x + LBL_SIZE.Width, y),
                Size = UPDOWN_SIZE,
                Maximum = 100000m,  // 100,000
                Minimum = 0m,
                TabIndex = row,
                Value = 100m,
                ThousandsSeparator = true,
            };
            Binding countBinding = new Binding("Value", _dataBS, "Count", false, DataSourceUpdateMode.OnPropertyChanged);
            _upDown.DataBindings.Add(countBinding);
        }
コード例 #6
0
 internal BindToObject(Binding owner, object dataSource, string dataMember)
 {
     this.owner = owner;
     this.dataSource = dataSource;
     this.dataMember = new System.Windows.Forms.BindingMemberInfo(dataMember);
     this.CheckBinding();
 }
コード例 #7
0
 public BarEditItemTextBinding(BarEditItem control, object dataSource, string dataMember)
 {
     _control = control;
     _binding = new Binding("EditValue", dataSource, dataMember);
     DataBindings.Add(_binding);
     _control.EditValueChanged += _control_EditValueChanged;
 }
コード例 #8
0
        public AviExportAdvancedComponentControl(AviExportAdvancedComponent component)
            :base(component)
        {
			_component = component;
            InitializeComponent();

			base.AcceptButton = _buttonOk;
			base.CancelButton = _buttonCancel;
			
			_checkUseDefaultQuality.DataBindings.Add("Checked", _component, "UseDefaultQuality", true, DataSourceUpdateMode.OnPropertyChanged);
			_checkUseDefaultQuality.DataBindings.Add("Enabled", _component, "UseDefaultQualityEnabled", true, DataSourceUpdateMode.OnPropertyChanged);

        	_comboCodec.DataSource = _component.CodecInfoList;
			_comboCodec.DisplayMember = "Description";
			_comboCodec.DataBindings.Add("Value", _component, "SelectedCodecInfo", true, DataSourceUpdateMode.OnPropertyChanged);

			_trackBarQuality.DataBindings.Add("Enabled", _component, "QualityEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
			_trackBarQuality.DataBindings.Add("Minimum", _component, "MinQuality", true, DataSourceUpdateMode.OnPropertyChanged);
			_trackBarQuality.DataBindings.Add("Maximum", _component, "MaxQuality", true, DataSourceUpdateMode.OnPropertyChanged);
			_trackBarQuality.DataBindings.Add("Value", _component, "Quality", true, DataSourceUpdateMode.OnPropertyChanged);

			_quality.DataBindings.Add("Enabled", _component, "QualityEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
			Binding binding = new Binding("Text", _component, "Quality", true, DataSourceUpdateMode.OnPropertyChanged);
			binding.Format += new ConvertEventHandler(OnFormatQuality);
			_quality.DataBindings.Add(binding);
        }
コード例 #9
0
        // private Control _currentCtrl = null;
        public FrmSkontoEdit(SkontoViewModel viewModel)
        {
            InitializeComponent();

            ViewModel = viewModel;
            Binding b = new System.Windows.Forms.Binding("Value", this.bindSkontoEdit, "InvoiceDate", true,
                                                         System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged, null, "d");

            dateTimePicker1.DataBindings.Add(b);
            dateTimePicker2.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.bindSkontoEdit,
                                                                              "InvoiceDueDate", true,
                                                                              System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged, null, "d"));
            dateTimePicker3.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.bindSkontoEdit,
                                                                              "SkontoFaelligDate", true,
                                                                              System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged, null, "d"));
            Binding prz = new System.Windows.Forms.Binding("Text", this.bindSkontoEdit, "SkontoProzent", true,
                                                           System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged, null, "#.00");

            tBxProzent.DataBindings.Add(prz);
            bindSkontoEdit.DataSource = ViewModel;
            Bindings.Add(bindSkontoEdit);
            string ruleSet = ((SkontoViewModel)ViewModel).RuleSet;

            validationProvider1.RulesetName = ruleSet;
        }
コード例 #10
0
		public MouseImageViewerToolPropertyComponentControl(MouseImageViewerToolPropertyComponent component)
		{
			InitializeComponent();

			_chkInitiallySelected.DataBindings.Add("Checked", component, "InitiallyActive", false, DataSourceUpdateMode.OnPropertyChanged);

			_cboActiveMouseButtons.Format += OnCboActiveMouseButtonsFormat;
			_cboActiveMouseButtons.SelectedIndexChanged += OnComboBoxSelectedItemChangedUpdate;
			_cboActiveMouseButtons.Items.Add(XMouseButtons.Left);
			_cboActiveMouseButtons.Items.Add(XMouseButtons.Right);
			_cboActiveMouseButtons.Items.Add(XMouseButtons.Middle);
			_cboActiveMouseButtons.Items.Add(XMouseButtons.XButton1);
			_cboActiveMouseButtons.Items.Add(XMouseButtons.XButton2);
			_cboActiveMouseButtons.SelectedIndex = 0;
			_cboActiveMouseButtons.DataBindings.Add("SelectedItem", component, "ActiveMouseButtons", true, DataSourceUpdateMode.OnPropertyChanged);

			_cboGlobalMouseButtons.Format += OnCboActiveMouseButtonsFormat;
			_cboGlobalMouseButtons.SelectedIndexChanged += OnComboBoxSelectedItemChangedUpdate;
			_cboGlobalMouseButtons.Items.Add(XMouseButtons.None);
			_cboGlobalMouseButtons.Items.Add(XMouseButtons.Left);
			_cboGlobalMouseButtons.Items.Add(XMouseButtons.Right);
			_cboGlobalMouseButtons.Items.Add(XMouseButtons.Middle);
			_cboGlobalMouseButtons.Items.Add(XMouseButtons.XButton1);
			_cboGlobalMouseButtons.Items.Add(XMouseButtons.XButton2);
			_cboGlobalMouseButtons.SelectedIndex = 0;
			_cboGlobalMouseButtons.DataBindings.Add("SelectedItem", component, "GlobalMouseButtons", true, DataSourceUpdateMode.OnPropertyChanged);

			Binding keyModifierBinding = new Binding("KeyModifiers", component, "GlobalModifiers", true, DataSourceUpdateMode.OnPropertyChanged);
			keyModifierBinding.Format += OnKeyModifierBindingConvert;
			keyModifierBinding.Parse += OnKeyModifierBindingConvert;
			_chkGlobalModifiers.DataBindings.Add(keyModifierBinding);
		}
コード例 #11
0
ファイル: Options.cs プロジェクト: Answeror/focus
        public Options()
        {
            InitializeComponent();

            var bind = new Binding("Value", Properties.Settings.Default, "Opacity");
            bind.Format += (sender, e) => { e.Value = (int)Math.Round((double)e.Value * 100); };
            opacityTrackBar.DataBindings.Add(bind);
            opacityTrackBar.ValueChanged += delegate
            {
                Properties.Settings.Default.Opacity = opacityTrackBar.Value / 100.0;
            };

            //controlCheckBox.CheckedChanged += delegate
            //{
            //    Properties.Settings.Default.Control = controlCheckBox.Checked;
            //};
            //shiftCheckBox.CheckedChanged += delegate
            //{
            //    Properties.Settings.Default.Shift = shiftCheckBox.Checked;
            //};
            //altCheckBox.CheckedChanged += delegate
            //{
            //    Properties.Settings.Default.Alt = altCheckBox.Checked;
            //};
            //keyComboBox.TextChanged += delegate
            //{
            //    Properties.Settings.Default.Key = keyComboBox.Text;
            //};
        }
コード例 #12
0
ファイル: ComboBoxBinder.cs プロジェクト: kanbang/Colt
        // We need to force WriteValue() on SelectedIndexChanged otherwise it will only call WriteValue()
        // on loss of focus.
        // http://stackoverflow.com/questions/1060080/databound-winforms-control-does-not-recognize-change-until-losing-focus
        /// <summary>
        /// Binds the specified combobox
        /// </summary>
        /// <param name="cmb"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static Binding BindSelectedIndexChanged(ComboBox cmb, Binding b)
        {
            cmb.DataBindings.Add(b);
            cmb.SelectedIndexChanged += (sender, e) => { b.WriteValue(); };

            return b;
        }
 protected internal void Remove(Binding binding)
 {
     CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Remove, binding);
     this.OnCollectionChanging(e);
     this.RemoveCore(binding);
     this.OnCollectionChanged(e);
 }
コード例 #14
0
        /// <summary>
        /// Constructor
        /// </summary>
        public ShredHostClientComponentControl(ShredHostClientComponent component)
            :base(component)
        {
            InitializeComponent();  

            _component = component;

            // TODO add .NET databindings to _component

            // create a binding that will show specific text based on the boolean value
            // of whether the shred host is running
            Binding binding = new Binding("Text", _component, "IsShredHostRunning");
            binding.Parse += new ConvertEventHandler(IsShredHostRunningParse);
            binding.Format += new ConvertEventHandler(IsShredHostRunningFormat);
            _shredHostGroupBox.DataBindings.Add(binding);

            Binding binding2 = new Binding("Text", _component, "IsShredHostRunning");
            binding2.Parse += new ConvertEventHandler(IsShredHostToggleButtonParse);
            binding2.Format += new ConvertEventHandler(IsShredHostToggleButtonFormat);
            _toggleButton.DataBindings.Add(binding2);

            _shredCollectionTable.Table = _component.ShredCollection;
            _shredCollectionTable.SelectionChanged += new EventHandler(OnShredTableSelectionChanged);
            _shredCollectionTable.ToolStripItemDisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
            _shredCollectionTable.ToolbarModel = _component.ToolbarModel;
            _shredCollectionTable.MenuModel = _component.ContextMenuModel;

            _toggleButton.Click += delegate(object source, EventArgs args)
            {
                _component.Toggle();
            };
        }
コード例 #15
0
        private void DropDownPicker()
        {
            if (this.designBindingPicker == null)
            {
                this.designBindingPicker       = new DesignBindingPicker();
                this.designBindingPicker.Width = base.Width;
            }
            DesignBinding initialSelectedItem = null;

            if (this.binding != null)
            {
                initialSelectedItem = new DesignBinding(this.binding.DataSource, this.binding.BindingMemberInfo.BindingMember);
            }
            DesignBinding binding2 = this.designBindingPicker.Pick(this, this, true, true, false, null, string.Empty, initialSelectedItem);

            if (binding2 != null)
            {
                System.Windows.Forms.Binding binding      = this.binding;
                System.Windows.Forms.Binding binding4     = null;
                string               formatString         = (binding != null) ? binding.FormatString : string.Empty;
                IFormatProvider      formatInfo           = (binding != null) ? binding.FormatInfo : null;
                object               nullValue            = (binding != null) ? binding.NullValue : null;
                DataSourceUpdateMode dataSourceUpdateMode = (binding != null) ? binding.DataSourceUpdateMode : this.defaultDataSourceUpdateMode;
                if ((binding2.DataSource != null) && !string.IsNullOrEmpty(binding2.DataMember))
                {
                    binding4 = new System.Windows.Forms.Binding(this.propertyName, binding2.DataSource, binding2.DataMember, true, dataSourceUpdateMode, nullValue, formatString, formatInfo);
                }
                this.Binding = binding4;
                if ((((binding4 == null) || (binding != null)) || ((binding4 != null) && (binding == null))) || (((binding4 != null) && (binding != null)) && ((binding4.DataSource != binding.DataSource) || !binding4.BindingMemberInfo.Equals(binding.BindingMemberInfo))))
                {
                    this.OnPropertyValueChanged(EventArgs.Empty);
                }
            }
        }
コード例 #16
0
ファイル: ControlUtils.cs プロジェクト: shenbaoNew/e10
        public static DigiwinTextBox CreateNumericTextBox(DependencyObject dataSource, string name, string bindingPropertyName
                                                          , string text, bool isOnlyNumber
                                                          , bool isReadOnly, bool visible, int maxLength, int tabIndex)
        {
            DigiwinTextBox txtSetValue = new DigiwinTextBox();

            txtSetValue.Name       = name;
            txtSetValue.TabIndex   = tabIndex;
            txtSetValue.OnlyNumber = isOnlyNumber;
            txtSetValue.ReadOnly   = false;
            txtSetValue.MaxLength  = maxLength;
            txtSetValue.Visible    = visible;

            if (!string.IsNullOrEmpty(bindingPropertyName))
            {
                Binding bind = new System.Windows.Forms.Binding("Text", dataSource.DefaultView, bindingPropertyName, false, DataSourceUpdateMode.OnPropertyChanged, 0);
                txtSetValue.DataBindings.Add(bind);
            }
            else
            {
                decimal temp = 0m;
                if (decimal.TryParse(text, out temp))
                {
                    txtSetValue.Text = text;
                }
            }

            return(txtSetValue);
        }
コード例 #17
0
ファイル: BindingTest.cs プロジェクト: KonajuGames/SharpLang
		public void CtorNullTest ()
		{
			Binding b = new Binding (null, null, null);

			Assert.IsNull (b.PropertyName, "ctornull1");
			Assert.IsNull (b.DataSource, "ctornull2");
		}
コード例 #18
0
 public void Set(Control control, string PropertyName, string DataMemberName)
 {
     Binding binding = new Binding(PropertyName, this, DataMemberName);
     binding.FormattingEnabled = true;
     binding.DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged;
     control.DataBindings.Add(binding);
     ControlBindings.Add(new ControlBinding(control, PropertyName, DataMemberName));
 }
 protected virtual void AddCore(Binding dataBinding)
 {
     if (dataBinding == null)
     {
         throw new ArgumentNullException("dataBinding");
     }
     this.List.Add(dataBinding);
 }
コード例 #20
0
	protected virtual void AddCore(Binding binding)
			{
				if(binding == null)
				{
					throw new ArgumentNullException("binding");
				}
				List.Add(binding);
			}
コード例 #21
0
ファイル: BindingHelper.cs プロジェクト: AleksMorozova/prizm
 public static Binding CreateCheckEditInverseBinding(string propertyName, object dataSource, string dataMember)
 {
     Binding bind = new Binding(propertyName, dataSource, dataMember);
     bind.FormattingEnabled = true;
     bind.Format += new ConvertEventHandler(BindingHelper.Invert);
     bind.Parse += new ConvertEventHandler(BindingHelper.Invert);
     return bind;
 }
コード例 #22
0
ファイル: ABMPais.cs プロジェクト: kopatekopete/MSF50_Test
        protected override void BindControls()
        {
            DescripcionBinding = DescripcionTB.DataBindings.Add("Text", _bs, "DescripcionPais", true, DataSourceUpdateMode.Never);
            IdiomaBinding = fKBoxIdioma.DataBindings.Add("SelectedItem", _bs, "Idioma", true, DataSourceUpdateMode.Never);
            SiglaBinding = siglaTB.DataBindings.Add("Text", _bs, "Sigla", true, DataSourceUpdateMode.Never);

            _bs.AddingNew += Bs_AddingNew;
        }
コード例 #23
0
		public BindingCompleteEventArgs(Binding binding, BindingCompleteState state, BindingCompleteContext context, string errorText, Exception exception, bool cancel)
			: base (cancel)
		{
			this.binding = binding;
			this.state = state;
			this.context = context;
			this.error_text = errorText;
			this.exception = exception;
		}
 protected override void RemoveCore(Binding dataBinding)
 {
     if (dataBinding.BindingManagerBase != this.bindingManagerBase)
     {
         throw new ArgumentException(System.Windows.Forms.SR.GetString("BindingsCollectionForeign"));
     }
     dataBinding.SetListManager(null);
     base.RemoveCore(dataBinding);
 }
コード例 #25
0
	// Add an entry to this collection.
	protected internal void Add(Binding binding)
			{
				AddCore(binding);
			#if CONFIG_COMPONENT_MODEL
				OnCollectionChanged
					(new CollectionChangeEventArgs
						(CollectionChangeAction.Add, binding));
			#endif
			}
コード例 #26
0
        public ConverterBinding(IValueConverter valueConverter, Control control, Binding binding)
        {
            ValueConverter = valueConverter;
            Control        = control;
            Binding        = binding;

            Binding.Format += Convert;
            Binding.Parse  += ConvertBack;
            Control.DataBindings.Add(Binding);
        }
コード例 #27
0
        public ConverterBinding(IValueConverter valueConverter, Control control, Binding binding)
        {
            ValueConverter = valueConverter;
            Control = control;
            Binding = binding;

            Binding.Format += Convert;
            Binding.Parse += ConvertBack;
            Control.DataBindings.Add(Binding);
        }
コード例 #28
0
ファイル: TextBoxBinder.cs プロジェクト: kanbang/Colt
        // We need to force WriteValue() on TextChanged otherwise it will only call WriteValue()
        // on loss of focus.
        // http://stackoverflow.com/questions/1060080/databound-winforms-control-does-not-recognize-change-until-losing-focus
        /// <summary>
        /// Binds the specified text box
        /// </summary>
        /// <param name="txt"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static Binding BindText(TextBoxBase txt, Binding b)
        {
            txt.DataBindings.Add(b);
            txt.TextChanged += (sender, e) =>
            {
                b.WriteValue();
            };

            return b;
        }
コード例 #29
0
        private void SimpleDataBinding_Load(object sender, EventArgs e)
        {
            LoadData();

            Binding customerIdBinding = new Binding("Text", currentCustomer, "ID");
            customerId.DataBindings.Add(customerIdBinding);

            Binding customerNameBinding = new Binding("Text", currentCustomer, "Name");
            customerName.DataBindings.Add(customerNameBinding);
        }
コード例 #30
0
ファイル: BindingTest.cs プロジェクト: KonajuGames/SharpLang
		public void CtorEmptyProperty ()
		{
			Binding b = new Binding ("Text", 6, String.Empty);
			Control c = new Control ();
			c.BindingContext = new BindingContext ();
			c.CreateControl ();

			c.DataBindings.Add (b);
			Assert.AreEqual ("6", c.Text, "A1");
		}
コード例 #31
0
        public FrmSkontoList(SkontoViewModels viewModel)
        {
            InitializeComponent();
            ViewModel = viewModel;
            Binding b = new System.Windows.Forms.Binding("Value", this.bindSrcSkonto, "InvoiceDate", true,
                                                         System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged, null, "d");

            invoiceDateTimePicker.DataBindings.Add(b);
            bindSrcSkonto.DataSource = (SkontoViewModels)ViewModel;
        }
 public Binding Add(string propertyName, object dataSource, string dataMember, bool formattingEnabled, DataSourceUpdateMode updateMode, object nullValue, string formatString, IFormatProvider formatInfo)
 {
     if (dataSource == null)
     {
         throw new ArgumentNullException("dataSource");
     }
     Binding binding = new Binding(propertyName, dataSource, dataMember, formattingEnabled, updateMode, nullValue, formatString, formatInfo);
     this.Add(binding);
     return binding;
 }
コード例 #33
0
 public DiceUserControl()
 {
     InitializeComponent();
     BackgroundImageLayout = ImageLayout.Stretch;
     Binding bind = new Binding("BackgroundImage", bsDice, "LastThrowDiceValue");
     bind.Format += (s, e) => {
         e.Value = dices[((e.Value as RainyDiceValue) != null ? (e.Value as RainyDiceValue).SequenceNumber : 6)];
     };
     DataBindings.Add(bind);
 }
コード例 #34
0
ファイル: ConnectionWindow.cs プロジェクト: scrato/IDD_Test
 public ConnectionWindow(IClientToServerModel config)
 {
     InitializeComponent();
      ipBinding = new Binding("Text", config, "IP");
      portBinding  = new Binding("Text", config, "Port");
      userBinding = new Binding("Text", config, "Username");
      tbIP.DataBindings.Add(ipBinding);
      tbPort.DataBindings.Add(portBinding);
      tbNick.DataBindings.Add(userBinding);
 }
コード例 #35
0
		/// <summary>
		/// Constructor
		/// </summary>
		public DateFormatApplicationComponentControl(DateFormatApplicationComponent component)
		{
			InitializeComponent();
			
			BindingSource source = new BindingSource();
			source.DataSource = _component = component;

			_comboCustomDateFormat.DataSource = _component.AvailableCustomFormats;
			//for whatever reason, the combobox's initial value doesn't get set via the binding, so we'll just set it explicitly.
			_comboCustomDateFormat.SelectedIndex = _comboCustomDateFormat.Items.IndexOf(_component.SelectedCustomFormat);
			_comboCustomDateFormat.DataBindings.Add("SelectedValue", source, "SelectedCustomFormat", true, DataSourceUpdateMode.OnPropertyChanged);
			_comboCustomDateFormat.DataBindings.Add("Enabled", _radioCustom, "Checked", true, DataSourceUpdateMode.OnPropertyChanged);

			_dateSample.DataBindings.Add("Text", source, "SampleDate", true, DataSourceUpdateMode.OnPropertyChanged);

			Binding customBinding = new Binding("Checked", source, "FormatOption", true, DataSourceUpdateMode.OnPropertyChanged);
			Binding systemShortBinding = new Binding("Checked", source, "FormatOption", true, DataSourceUpdateMode.OnPropertyChanged);
			Binding systemLongBinding = new Binding("Checked", source, "FormatOption", true, DataSourceUpdateMode.OnPropertyChanged);
			
			_radioCustom.DataBindings.Add("Enabled", source, "CustomFormatsEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
			
			_radioCustom.DataBindings.Add(customBinding);
			_radioSystemLongDate.DataBindings.Add(systemLongBinding);
			_radioSystemShortDate.DataBindings.Add(systemShortBinding);

			customBinding.Parse += new ConvertEventHandler(OnRadioBindingParse);
			systemLongBinding.Parse += new ConvertEventHandler(OnRadioBindingParse);
			systemShortBinding.Parse += new ConvertEventHandler(OnRadioBindingParse);

			//to use databindings on a group of radio buttons, this is essentially what you have to do.  You might also be
			//able to use a groupbox, but this is easy enough to do.
			customBinding.Format += delegate(object sender, ConvertEventArgs e)
			                        	{
			                        		if (e.DesiredType != typeof(bool))
			                        			return;

			                        		e.Value = ((DateFormatApplicationComponent.DateFormatOptions)e.Value) == DateFormatApplicationComponent.DateFormatOptions.Custom;
			                        	};

			systemLongBinding.Format += delegate(object sender, ConvertEventArgs e)
			                            	{
			                            		if (e.DesiredType != typeof(bool))
			                            			return;

			                            		e.Value = ((DateFormatApplicationComponent.DateFormatOptions)e.Value) == DateFormatApplicationComponent.DateFormatOptions.SystemLong;
			                            	};

			systemShortBinding.Format += delegate(object sender, ConvertEventArgs e)
			                             	{
			                             		if (e.DesiredType != typeof(bool))
			                             			return;

			                             		e.Value = ((DateFormatApplicationComponent.DateFormatOptions)e.Value) == DateFormatApplicationComponent.DateFormatOptions.SystemShort;
			                             	};
		}
コード例 #36
0
        public static void LoadAndMonitor(INotifyPropertyChanged source, string sourceProperty, System.Windows.Forms.Control control, string controlProperty = null)
        {
            ConvertEventHandler format = null;
            ConvertEventHandler parse  = null;
            var pi = source.GetType().GetProperty(sourceProperty);

            if (controlProperty == null)
            {
                if (control is System.Windows.Forms.CheckBox)
                {
                    if (pi.PropertyType == typeof(EnabledState))
                    {
                        controlProperty = nameof(System.Windows.Forms.CheckBox.CheckState);
                        // Convert to control type.
                        format = (sender, e) =>
                        {
                            var value = (EnabledState)e.Value;
                            e.Value = value == EnabledState.None
                                                                ? CheckState.Indeterminate
                                                                : value == EnabledState.Enabled
                                                                        ? CheckState.Checked
                                                                        : CheckState.Unchecked;
                        };
                        // Convert to source type.
                        parse = (sender, e) =>
                        {
                            var value = (CheckState)e.Value;
                            e.Value = value == CheckState.Indeterminate
                                                                ? EnabledState.None
                                                                : value == CheckState.Checked
                                                                        ? EnabledState.Enabled
                                                                        : EnabledState.Disabled;
                        };
                    }
                    else
                    {
                        controlProperty = nameof(System.Windows.Forms.CheckBox.Checked);
                    }
                }
            }
            var binding = new System.Windows.Forms.Binding(controlProperty, source, sourceProperty);

            binding.DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged;
            binding.ControlUpdateMode    = ControlUpdateMode.OnPropertyChanged;
            if (parse != null)
            {
                binding.FormattingEnabled = true;
                binding.Format           += format;
                binding.Parse            += parse;
            }
            control.DataBindings.Add(binding);
        }
コード例 #37
0
        private void ProgramacionServiciosClientes_Load(object sender, EventArgs e)
        {
            if (!DesignMode)
            {
                ProgramacionServiciosClienteRepositorio = CommonServiceLocator.ServiceLocator.Current.GetInstance <IProgramacionServiciosCliente>();
                vistaProgramacionServiciosCliente       = CommonServiceLocator.ServiceLocator.Current.GetInstance <IVSProgramacionServiciosCliente>();
                serviciosProgramados = CommonServiceLocator.ServiceLocator.Current.GetInstance <IServiciosProgramados>();
                ClientesRepositorio  = CommonServiceLocator.ServiceLocator.Current.GetInstance <IClientes>();

                //Se inicializa binding para que el boton de programar servicios se deshabilite cuando los servicios ya hayan sido programados
                var binding = new System.Windows.Forms.Binding("Enabled", this.programacionserviciosclienteBindingSource, "ServiciosProgramados", true);
                binding.Parse  += (s, eargs) => eargs.Value = !((bool)eargs.Value);
                binding.Format += (s, eargs) => eargs.Value = !((bool)eargs.Value);
                this.btnProgramarServicios.DataBindings.Add(binding);
            }
        }
コード例 #38
0
        /// <summary>
        /// This procedure retrieves the datastructure of the textboxes
        ///
        /// </summary>
        /// <returns>void</returns>
        private void RetrieveDataSourceDetails(System.Windows.Forms.Binding ABinding, System.Data.DataRow ADataRow)
        {
            System.Object mDataSource;
            String        mTableName = "";
            String        mField;
            String        mColumnName = "";
            String        mBindingMember;

            System.Collections.Specialized.StringCollection mStringArray;
            mDataSource = ABinding.DataSource;

            if (mDataSource is System.Data.DataView)
            {
                // Messagebox.Show('DataType: ' + mDataSource.GetType().ToString  + "\n" + 'BindingMember: ' + ABinding.BindingMemberInfo.BindingMember.ToString);
                mTableName  = ((System.Data.DataView)mDataSource).Table.ToString();
                mField      = ABinding.BindingMemberInfo.BindingField;
                mColumnName = StringHelper.UpperCamelCase(mField, true, true);
            }
            else if (mDataSource is System.Data.DataTable)
            {
                // Messagebox.Show('DataType: ' + mDataSource.GetType().ToString  + "\n" + 'BindingMember: ' + ABinding.BindingMemberInfo.BindingMember.ToString);
                mTableName  = ((System.Data.DataTable)mDataSource).ToString();
                mField      = ABinding.BindingMemberInfo.BindingField;
                mColumnName = StringHelper.UpperCamelCase(mField, true, true);
            }
            else if (mDataSource is System.Data.DataSet)
            {
                mBindingMember = ABinding.BindingMemberInfo.BindingMember.ToString();
                mStringArray   = StringHelper.StrSplit(mBindingMember, ".");
                mTableName     = String.Copy(mStringArray[0]);
                mField         = String.Copy(mStringArray[1]);
                mColumnName    = StringHelper.UpperCamelCase(mField, true, true);

                // Messagebox.Show('DataSet!!!' + "\n" + 'TableName: ' + mTableName + "\n" + 'ColumnName: ' + mField);
            }
            else
            {
                MessageBox.Show(
                    mDataSource.GetType().ToString() + "\n" + ABinding.BindingMemberInfo.BindingMember.ToString() + "\n" +
                    " Please ask the programmer you trust to put in some more code here!!!");
            }

            ADataRow[strFoundControlTableName]  = mTableName;
            ADataRow[strFoundControlColumnName] = mColumnName;

            // Messagebox.Show('TableName: ' + ADataRow[strFoundControlTableName].ToString + ' ColumnName: ' + ADataRow[strFoundControlColumnName].ToString);
        }
            private static string GetToolTip(System.Windows.Forms.Binding binding)
            {
                string name = "";

                if (binding.DataSource is IComponent)
                {
                    IComponent dataSource = (IComponent)binding.DataSource;
                    if (dataSource.Site != null)
                    {
                        name = dataSource.Site.Name;
                    }
                }
                if (name.Length == 0)
                {
                    name = "(List)";
                }
                return(name + " - " + binding.BindingMemberInfo.BindingMember);
            }
コード例 #40
0
        public object GetCurrentlyBoundId()
        {
            System.Windows.Forms.Binding binding = GetSelectedValueBinding();
            if (binding == null)
            {
                return(null);
            }
            if (((System.Windows.Forms.BindingSource)binding.DataSource).Count == 0)
            {
                return(null);
            }
            object obj = ((System.Windows.Forms.BindingSource)binding.DataSource)[0];

            System.Type type = obj.GetType();
            System.Windows.Forms.BindingMemberInfo bindingMemberInfo = binding.BindingMemberInfo;
            string s = bindingMemberInfo.BindingMember;

            System.Reflection.PropertyInfo propertyInfo = type.GetProperty(s);
            return(propertyInfo.GetValue(obj, null));
        }
コード例 #41
0
        void BindControls()
        {
            Binding bind = new System.Windows.Forms.Binding("Enabled", cbUseWin7LibraryInstead, "Checked", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);

            bind.Format += SwitchBool;
            bind.Parse  += SwitchBool;
            this.lvRecTVFolders.DataBindings.Add(bind);

            Binding bind2 = new System.Windows.Forms.Binding("Enabled", cbUseWin7LibraryInstead, "Checked", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);

            bind2.Format += SwitchBool;
            bind2.Parse  += SwitchBool;
            this.btnAddFolder.DataBindings.Add(bind2);

            Binding bind3 = new System.Windows.Forms.Binding("Enabled", cbUseWin7LibraryInstead, "Checked", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);

            bind3.Format += SwitchBool;
            bind3.Parse  += SwitchBool;
            this.btnDeleteFolder.DataBindings.Add(bind3);
        }
コード例 #42
0
 private void formateBindControl(Control editCtl, System.Windows.Forms.Binding binding, MB.WinBase.Common.ColumnPropertyInfo colCfg)
 {
     if (string.Compare(colCfg.DataType, "System.DateTime?", true) == 0)
     {
         DateTimePicker date = editCtl as DateTimePicker;
         if (date != null)
         {
             binding.BindingComplete += new BindingCompleteEventHandler(binding_BindingComplete);
             date.ShowCheckBox        = true;
         }
     }
     else if (string.Compare(colCfg.DataType, "System.Decimal", true) == 0 && colCfg.IsFormatControl)
     {
         NumericUpDown num = editCtl as NumericUpDown;
         if (num != null)
         {
             num.ThousandsSeparator = colCfg.ThousandsSeperator;
             num.DecimalPlaces      = colCfg.MaxDecimalPlaces;
         }
     }
 }
コード例 #43
0
 private void UpdateNullBinding()
 {
     if (Nullable && (_ItemType != null))
     {
         System.Windows.Forms.Binding binding = GetSelectedValueBinding();
         if (binding != null)
         {
             System.Reflection.PropertyInfo propertyInfo1 = _ItemType.GetProperty(ValueMember);
             binding.NullValue = propertyInfo1.GetValue(GetNullItem(), null);
             if (binding == null)
             {
                 binding.DataSourceNullValue = binding.NullValue;
                 return;
             }
             System.Type type = GetBoundType(binding);
             System.Windows.Forms.BindingMemberInfo bindingMemberInfo = binding.BindingMemberInfo;
             string s = bindingMemberInfo.BindingMember;
             System.Reflection.PropertyInfo propertyInfo2 = type.GetProperty(s);
             object obj = System.Activator.CreateInstance(propertyInfo2.PropertyType);
             binding.DataSourceNullValue = obj;
         }
     }
 }
コード例 #44
0
        private static string ConstructDisplayTextFromBinding(System.Windows.Forms.Binding binding)
        {
            string name;

            if (binding.DataSource == null)
            {
                name = System.Design.SR.GetString("DataGridNoneString");
            }
            else if (binding.DataSource is IComponent)
            {
                IComponent dataSource = binding.DataSource as IComponent;
                if (dataSource.Site != null)
                {
                    name = dataSource.Site.Name;
                }
                else
                {
                    name = "";
                }
            }
            else if (((binding.DataSource is IListSource) || (binding.DataSource is IList)) || (binding.DataSource is Array))
            {
                name = System.Design.SR.GetString("BindingFormattingDialogList");
            }
            else
            {
                string className = TypeDescriptor.GetClassName(binding.DataSource);
                int    num       = className.LastIndexOf(".");
                if (num != -1)
                {
                    className = className.Substring(num + 1);
                }
                name = string.Format(CultureInfo.CurrentCulture, "({0})", new object[] { className });
            }
            return(name + " - " + binding.BindingMemberInfo.BindingMember);
        }
コード例 #45
0
 /// <include file='doc\BindingCompleteEventArgs.uex' path='docs/doc[@for="BindingCompleteEventArgs.BindingCompleteEventArgs3"]/*' />
 /// <devdoc>
 ///    Constructor for BindingCompleteEventArgs.
 /// </devdoc>
 public BindingCompleteEventArgs(Binding binding,
                                 BindingCompleteState state,
                                 BindingCompleteContext context) : this(binding, state, context, string.Empty, null, false)
 {
 }
コード例 #46
0
 /// <summary>
 /// todoComment
 /// </summary>
 /// <param name="ADataSource"></param>
 /// <param name="ADataMember"></param>
 /// <returns></returns>
 public System.Windows.Forms.Binding PerformDataBindingTextBoxMiddlePanel(System.Data.DataView ADataSource, String ADataMember)
 {
     this.FDataBindingTextboxMiddlePanel = new System.Windows.Forms.Binding("Text", ADataSource, ADataMember);
     return(this.FDataBindingTextboxMiddlePanel);
 }
コード例 #47
0
 // may throw
 private static void CheckPropertyBindingCycles(BindingContext newBindingContext, Binding propBinding)
 {
     if (newBindingContext == null || propBinding == null)
     {
         return;
     }
     if (newBindingContext.Contains(propBinding.Control, ""))
     {
         // this way we do not add a bindingManagerBase to the
         // bindingContext if there isn't one already
         BindingManagerBase bindingManagerBase = newBindingContext.EnsureListManager(propBinding.Control, "");
         for (int i = 0; i < bindingManagerBase.Bindings.Count; i++)
         {
             Binding binding = bindingManagerBase.Bindings[i];
             if (binding.DataSource == propBinding.Control)
             {
                 if (propBinding.BindToObject.BindingMemberInfo.BindingMember.Equals(binding.PropertyName))
                 {
                     throw new ArgumentException(SR.GetString(SR.DataBindingCycle, binding.PropertyName), "propBinding");
                 }
             }
             else if (propBinding.BindToObject.BindingManagerBase is PropertyManager)
             {
                 CheckPropertyBindingCycles(newBindingContext, binding);
             }
         }
     }
 }
コード例 #48
0
 public static ConverterBinding Bind(this IValueConverter converter, Control control, Binding binding)
 {
     return(new ConverterBinding(converter, control, binding));
 }
 internal LocalUIItem(DesignBindingValueUIHandler handler, System.Windows.Forms.Binding binding) : base(handler.DataBitmap, new PropertyValueUIItemInvokeHandler(handler.OnPropertyValueUIItemInvoke), GetToolTip(binding))
 {
     this.binding = binding;
 }
コード例 #50
0
        //绑定ButtonClick

        #region 内部函数处理...


        //控件编辑绑定。
        private void ctlDataBingByDataBinding(Dictionary <string, MB.WinBase.Common.ColumnPropertyInfo> editCfgColumns, string[] dataPropertys,
                                              System.Windows.Forms.BindingSource bindingSource,
                                              MB.WinBase.Binding.IDataBindingProvider dataBindingProvider,
                                              DataBindingOptions bindingOptions,
                                              List <ColumnBindingInfo> bindingDatas,
                                              Dictionary <string, MB.WinBase.Common.ColumnEditCfgInfo> columnEditInfoList)
        {
            if (dataBindingProvider == null || dataBindingProvider.DataBindings == null || dataBindingProvider.DataBindings.Count == 0)
            {
                return;
            }

            Dictionary <Control, DesignColumnXmlCfgInfo> bindingCtls = dataBindingProvider.DataBindings;

            foreach (Control ctl in bindingCtls.Keys)
            {
                string ctlTypeName = ctl.GetType().Name;
                if (_DESCRIPTION_CONTROLS.Contains <string>(ctlTypeName))
                {
                    continue;
                }

                string ctlBindingName   = getCtlBindingPropertyName(ctl);
                string dataPropertyName = bindingCtls[ctl].ColumnName;
                if (Array.IndexOf <string>(dataPropertys, dataPropertyName) < 0)
                {
                    continue;
                }

                MB.WinBase.Common.ColumnPropertyInfo colCfg = null;
                if (editCfgColumns.ContainsKey(dataPropertyName))
                {
                    colCfg = editCfgColumns[dataPropertyName];
                }

                if (editCfgColumns != null && editCfgColumns.ContainsKey(dataPropertyName))
                {
                    //特殊处理,绑定到特殊的控件。
                    ColumnBindingInfo ctlBinding = new ColumnBindingInfo(dataPropertyName, colCfg, ctl);
                    if (!colCfg.CanEdit)
                    {
                        setEditControlReadonly(ctl, true);
                    }

                    //如果是string 类型 并且设置MacLength 同时绑订的是TextBox 控件,那么就限制它的输入长度
                    if (string.Compare(colCfg.DataType, "System.String", true) == 0)
                    {
                        TextBox txtBox = ctl as TextBox;
                        if (txtBox != null && colCfg.MaxLength > 0)
                        {
                            txtBox.MaxLength = colCfg.MaxLength;
                        }
                    }
                    bindingDatas.Add(ctlBinding);
                }


                System.Windows.Forms.Binding binding = new System.Windows.Forms.Binding(ctlBindingName, bindingSource,
                                                                                        dataPropertyName, true, DataSourceUpdateMode.OnPropertyChanged); //DataSourceUpdateMode.OnValidation

                if (colCfg != null)
                {
                    formateBindControl(ctl, binding, colCfg);
                }
                //编辑界面的数据绑定分3步来完成

                //1,先绑定ComboBox 的数据源
                if (columnEditInfoList != null && columnEditInfoList.Count > 0)
                {
                    FillComboxLookUp(ctl, dataPropertyName, editCfgColumns, columnEditInfoList, false);
                }

                //2,绑定点击选择数据的数据源
                if (columnEditInfoList != null && columnEditInfoList.ContainsKey(dataPropertyName))
                {
                    bindingToSpecialEditCtl(ctl, columnEditInfoList[dataPropertyName]);
                }

                //3,控件编辑绑定
                ctl.DataBindings.Add(binding);
            }
        }
コード例 #51
0
        private void ctlDataBingByCtlName(Dictionary <string, MB.WinBase.Common.ColumnPropertyInfo> editCfgColumns, string[] dataPropertys,
                                          System.Windows.Forms.BindingSource bindingSource,
                                          System.Windows.Forms.Control.ControlCollection ctls,
                                          DataBindingOptions bindingOptions,
                                          List <ColumnBindingInfo> bindingDatas,
                                          Dictionary <string, MB.WinBase.Common.ColumnEditCfgInfo> columnEditInfoList)
        {
            foreach (Control ctl in ctls)
            {
                string ctlTypeName = ctl.GetType().Name;
                if (_DESCRIPTION_CONTROLS.Contains <string>(ctlTypeName))
                {
                    continue;
                }

                if (_CONTAINER_CONTROLS.Contains(ctlTypeName))
                {
                    ctlDataBingByCtlName(editCfgColumns, dataPropertys, bindingSource, ctl.Controls, bindingOptions, bindingDatas, columnEditInfoList);
                    continue;
                }
                string sName = ctl.Name;

                if (sName.Length < MIN_CTL_NAME_LENGTH)
                {
                    MB.Util.TraceEx.Write("在执行BindingSourceEx.SetDataSource 方法时,控件" + sName + "的命名方式至少要大于" + MIN_CTL_NAME_LENGTH + "个字符。该控件以及所在的ChildControl将不进行处理,请检查。",
                                          MB.Util.APPMessageType.SysWarning);
                }
                if (sName.Length <= MIN_CTL_NAME_LENGTH)
                {
                    ctlDataBingByCtlName(editCfgColumns, dataPropertys, bindingSource, ctl.Controls, bindingOptions, bindingDatas, columnEditInfoList);
                    continue;
                }
                //获取控件需要进行绑定的属性名称。
                string ctlBindingName   = getCtlBindingPropertyName(ctl);
                string dataPropertyName = sName.Substring(CTL_LEFT_PREX_LENGTH, sName.Length - CTL_LEFT_PREX_LENGTH);
                if (Array.IndexOf <string>(dataPropertys, dataPropertyName) < 0)
                {
                    continue;
                }

                if (editCfgColumns != null && editCfgColumns.ContainsKey(dataPropertyName))
                {
                    MB.WinBase.Common.ColumnPropertyInfo colCfg = editCfgColumns[dataPropertyName];
                    ColumnBindingInfo ctlBinding = new ColumnBindingInfo(dataPropertyName, colCfg, ctl);
                    bindingDatas.Add(ctlBinding);
                }
                System.Windows.Forms.Binding binding = new System.Windows.Forms.Binding(ctlBindingName, bindingSource,
                                                                                        dataPropertyName, false, DataSourceUpdateMode.OnValidation);

                //编辑界面的数据绑定分3步来完成

                //1,先绑定ComboBox 的数据源
                if (columnEditInfoList != null && columnEditInfoList.Count > 0)
                {
                    FillComboxLookUp(ctl, dataPropertyName, editCfgColumns, columnEditInfoList, false);
                }
                //2,绑定点击选择数据的数据源

                //3,控件编辑绑定
                ctl.DataBindings.Add(binding);
            }
        }
コード例 #52
0
 /// <include file='doc\ControlBindingsCollection.uex' path='docs/doc[@for="ControlBindingsCollection.Remove"]/*' />
 /// <devdoc>
 /// Removes the given binding from the collection.
 /// An ArgumentNullException is thrown if this binding is null.  An ArgumentException is thrown
 /// if this binding doesn't belong to this collection.
 /// The CollectionChanged event is fired if it succeeds.
 /// </devdoc>
 public new void Remove(Binding binding)
 {
     base.Remove(binding);
 }
コード例 #53
0
 /// <include file='doc\ControlBindingsCollection.uex' path='docs/doc[@for="ControlBindingsCollection.Add"]/*' />
 /// <devdoc>
 /// Adds the binding to the collection.  An ArgumentNullException is thrown if this binding
 /// is null.  An exception is thrown if a binding to the same target and Property as an existing binding or
 /// if the binding's column isn't a valid column given this DataSource.Table's schema.
 /// Fires the CollectionChangedEvent.
 /// </devdoc>
 public new void Add(Binding binding)
 {
     base.Add(binding);
 }
コード例 #54
0
            public Control AddItemControl(PropertyModelView.OptionItemPropertyDescriptor prop,
                                          TableLayoutPanel clientControl, int count)
            {
                System.Windows.Forms.Binding viewBinding;
                bool   span          = false;
                string bindingTarget = "Value";

                Control inputControl = prop.GetAttribute(OptionItem.CUSTOM_DIALOGITEM_EDITOR) as Control;

                if (inputControl != null && inputControl is IDialogItemControl)
                {
                    span = true;
                }
                else
                {
                    Type editorType = prop.GetAttribute(OptionItem.CUSTOM_DIALOGITEM_EDITOR) as Type;
                    if (editorType != null)
                    {
                        Control c = System.Activator.CreateInstance(editorType) as Control;
                        if (c != null && c is IDialogItemControl)
                        {
                            inputControl = c;
                            span         = true;
                        }
                    }
                    else
                    {
                        //now build default editors
                        if (prop is PropertyModelView.OptionGroupPropertyDescriptor)
                        {
                            inputControl =
                                new DialogSectionControl(_enclosingInstance, prop.GetChildProperties(), prop, true);
                            span = true;
                            //don't bind...
                            bindingTarget = null;
                        }
                        else if (prop.Type == typeof(bool))
                        {
                            //checkbox for bools
                            inputControl = new CheckBoxWrapper();
                            bool supportUndefined =
                                (bool)prop.GetAttribute(OptionItem.SUPPORT_UNDEFINED_VALUE_ATTRIBUTE);
                            ((CheckBoxWrapper)inputControl).ThreeState = supportUndefined &&
                                                                         prop.GetValue(this) ==
                                                                         OptionItem.VALUE_UNDEFINED;
                        }
                        else
                        {
                            inputControl = new GenericValueEditor(prop);
                        }
                    }
                }
                inputControl.Size = inputControl.GetPreferredSize(new Size());

                clientControl.Controls.Add(inputControl, 1, count);
                _enclosingInstance.inputControls.Add(inputControl);
                inputControl.Anchor  = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Top;
                inputControl.Enabled = prop.Enabled;


                if (span)
                {
                    clientControl.SetColumnSpan(inputControl, 2);
                }
                else
                {
                    Label inputLabel = new Label();
                    inputLabel.AutoSize  = true;
                    inputLabel.TextAlign = ContentAlignment.MiddleLeft;
                    inputLabel.Text      = prop.DisplayName + ":";

                    //todo: needs serious overhaul...
                    inputLabel.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
                    clientControl.Controls.Add(inputLabel, 0, count);
                }
                if (bindingTarget != null)
                {
                    viewBinding =
                        new System.Windows.Forms.Binding(bindingTarget,
                                                         _enclosingInstance.bindingSource, prop.Name, true,
                                                         DataSourceUpdateMode.OnPropertyChanged);

                    inputControl.DataBindings.Add(viewBinding);
                }
                return(inputControl);
            }
コード例 #55
0
 internal BindingBuilder(System.Windows.Forms.Binding binding)
 {
     Contract.Requires <ArgumentNullException>(binding != null);
     _binding = binding;
 }
コード例 #56
0
 internal FormattingBindingBuilder(System.Windows.Forms.Binding binding)
 {
     Contract.Requires <ArgumentNullException>(binding != null);
     _binding = binding;
     _binding.FormattingEnabled = true;
 }
コード例 #57
0
 /// <include file='doc\BindingCompleteEventArgs.uex' path='docs/doc[@for="BindingCompleteEventArgs.BindingCompleteEventArgs2"]/*' />
 /// <devdoc>
 ///    Constructor for BindingCompleteEventArgs.
 /// </devdoc>
 public BindingCompleteEventArgs(Binding binding,
                                 BindingCompleteState state,
                                 BindingCompleteContext context,
                                 string errorText) : this(binding, state, context, errorText, null, true)
 {
 }
コード例 #58
0
 public static void UpdateBinding(BindingContext newBindingContext, Binding binding)
 {
 }