コード例 #1
0
        /// <include file='doc\ListBinding.uex' path='docs/doc[@for="Binding.Binding"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Initializes a new instance of the <see cref='System.Windows.Forms.Binding'/> using the specified property
        ///       name, object, and column.
        ///    </para>
        /// </devdoc>
        public Binding(string propertyName, Object dataSource, string dataMember)
        {
            this.bindToObject = new BindToObject(this, dataSource, dataMember);

            this.propertyName = propertyName;
            CheckBinding();
        }
コード例 #2
0
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters")]               // 'formatString' is an appropriate name, since its a string passed to the Format method
        public Binding(string propertyName, object dataSource, string dataMember, bool formattingEnabled, DataSourceUpdateMode dataSourceUpdateMode, object nullValue, string formatString, IFormatProvider formatInfo)
        {
            this.bindToObject = new BindToObject(this, dataSource, dataMember);

            this.propertyName         = propertyName;
            this.formattingEnabled    = formattingEnabled;
            this.formatString         = formatString;
            this.nullValue            = nullValue;
            this.formatInfo           = formatInfo;
            this.formattingEnabled    = formattingEnabled;
            this.dataSourceUpdateMode = dataSourceUpdateMode;

            CheckBinding();
        }
コード例 #3
0
        public Binding(string propertyName, object dataSource, string dataMember, bool formattingEnabled, DataSourceUpdateMode dataSourceUpdateMode, object nullValue, string formatString, IFormatProvider formatInfo)
        {
            DataSource        = dataSource;
            BindingMemberInfo = new BindingMemberInfo(dataMember);
            _bindToObject     = new BindToObject(this);

            PropertyName         = propertyName;
            _formattingEnabled   = formattingEnabled;
            _formatString        = formatString;
            _nullValue           = nullValue;
            _formatInfo          = formatInfo;
            DataSourceUpdateMode = dataSourceUpdateMode;

            CheckBinding();
        }
コード例 #4
0
        public static void UpdateBinding(BindingContext newBindingContext, Binding binding)
        {
            BindingManagerBase bindingManagerBase = binding.BindingManagerBase;

            if (bindingManagerBase != null)
            {
                bindingManagerBase.Bindings.Remove(binding);
            }
            if (newBindingContext != null)
            {
                if (binding.BindToObject.BindingManagerBase is PropertyManager)
                {
                    CheckPropertyBindingCycles(newBindingContext, binding);
                }
                BindToObject bindToObject = binding.BindToObject;
                newBindingContext.EnsureListManager(bindToObject.DataSource, bindToObject.BindingMemberInfo.BindingPath).Bindings.Add(binding);
            }
        }
コード例 #5
0
        /// <include file='doc\BindingContext.uex' path='docs/doc[@for="BindingContext.UpdateBinding"]/*' />
        /// <devdoc>
        ///     Associates a Binding with a different BindingContext. Intended for use by components that support
        ///     IBindableComponent, to update their Bindings when the value of IBindableComponent.BindingContext
        ///     is changed.
        /// </devdoc>
        public static void UpdateBinding(BindingContext newBindingContext, Binding binding)
        {
            BindingManagerBase oldManager = binding.BindingManagerBase;

            if (oldManager != null)
            {
                oldManager.Bindings.Remove(binding);
            }

            if (newBindingContext != null)
            {
                // we need to first check for cycles before adding this binding to the collection
                // of bindings.
                if (binding.BindToObject.BindingManagerBase is PropertyManager)
                {
                    CheckPropertyBindingCycles(newBindingContext, binding);
                }

                BindToObject       bindTo     = binding.BindToObject;
                BindingManagerBase newManager = newBindingContext.EnsureListManager(bindTo.DataSource, bindTo.BindingMemberInfo.BindingPath);
                newManager.Bindings.Add(binding);
            }
        }
コード例 #6
0
ファイル: Binding.cs プロジェクト: JianwenSun/cc
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters")] // 'formatString' is an appropriate name, since its a string passed to the Format method
        public Binding(string propertyName, Object dataSource, string dataMember, bool formattingEnabled, DataSourceUpdateMode dataSourceUpdateMode, object nullValue, string formatString, IFormatProvider formatInfo) {
            this.bindToObject = new BindToObject(this, dataSource, dataMember);

            this.propertyName = propertyName;
            this.formattingEnabled = formattingEnabled;
            this.formatString = formatString;
            this.nullValue = nullValue;
            this.formatInfo = formatInfo;
            this.formattingEnabled = formattingEnabled;
            this.dataSourceUpdateMode = dataSourceUpdateMode;

            CheckBinding();
        }