Ejemplo n.º 1
0
        public void Deny_Unrestricted()
        {
            DataBindingCollection dbc = new DataBindingCollection();

            Assert.AreEqual(0, dbc.Count, "Count");
            Assert.IsFalse(dbc.IsReadOnly, "IsReadOnly");
            Assert.IsFalse(dbc.IsSynchronized, "IsSynchronized");
            dbc.Add(db);
            Assert.AreSame(db, dbc["property"], "this[string]");
            Assert.IsNotNull(dbc.RemovedBindings, "RemovedBindings");
            Assert.IsNotNull(dbc.SyncRoot, "SyncRoot");
            Assert.IsNotNull(dbc.GetEnumerator(), "GetEnumerator");
            dbc.CopyTo(new DataBinding[1], 0);
            dbc.Clear();

            dbc.Add(db);
            dbc.Remove(db);

            dbc.Add(db);
            dbc.Remove("property");
            dbc.Remove("property", true);
            dbc.Changed += new EventHandler(Handler);
            Assert.IsFalse(dbc.Contains("property"), "Contains");
            dbc.Changed -= new EventHandler(Handler);
        }
 private void OnOKButtonClick(object sender, EventArgs e)
 {
     if (this._bindingsDirty)
     {
         ExpressionBindingCollection expressions  = ((IExpressionsAccessor)this.Control).Expressions;
         DataBindingCollection       dataBindings = ((IDataBindingsAccessor)this.Control).DataBindings;
         expressions.Clear();
         foreach (BindablePropertyNode node in this._bindablePropsTree.Nodes)
         {
             if (node.IsBound)
             {
                 expressions.Add(node.Binding);
                 if (dataBindings.Contains(node.Binding.PropertyName))
                 {
                     dataBindings.Remove(node.Binding.PropertyName);
                 }
             }
         }
         foreach (ExpressionBinding binding in this._complexBindings.Values)
         {
             expressions.Add(binding);
         }
     }
     base.DialogResult = DialogResult.OK;
     base.Close();
 }