Пример #1
0
        void ShowBindingPanel()
        {
            SavePanelStateAndClose();

            if (propertyList.SelectedIndex >= 0)
            {
                System.Windows.Data.BindingBase binding = GetExistingBinding(propertyList.SelectedItem as PropertyWrapper);
                if (binding != null)
                {
                    PropertyInfo propInfo = propertyList.SelectedItem as PropertyInfo;
                    List <BaseBindingPanelFactory> panels = GetAvailableBindingPanels();
                    foreach (BaseBindingPanelFactory panel in panels)
                    {
                        if (panel.CanWorkWithBinding(binding))
                        {
                            bindingPanel = panel.CreateInstance();
                            break;
                        }
                    }

                    if (bindingPanel != null)
                    {
                        bindingPanel.Initialize(element, propertyList.SelectedItem as PropertyWrapper, binding);
                        bindingPanel.Parent = panel1;
                        bindingPanel.Dock   = DockStyle.Fill;
                        enableInDesignerCheckbox.Checked = bindingPanel.EnableInDesigner;
                    }
                    CreateAssociationButton.Enabled = false;
                    bindingTypes.Enabled            = false;
                }
            }
        }
Пример #2
0
    internal void SetDisplayMemberBinding( BindingBase value )
    {
      // Disable warning for DisplayMemberBinding when internaly used
#pragma warning disable 618
      this.DisplayMemberBinding = value;
#pragma warning restore 618
    }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConditionItem"/> class.
        /// </summary>
        public ConditionItem(BindingBase binding, object instance, object value)
        {
            _binding = binding;
            _instance = instance;
            _value = value;

            HookBinding();
        }
Пример #4
0
    internal static Column Create( string fieldName, object title, BindingBase displayMemberBinding )
    {
      // Disable warning for DisplayMemberBinding when internaly used
#pragma warning disable 618
      var column = new Column( fieldName, title, displayMemberBinding );
#pragma warning restore 618

      return column;
    }
Пример #5
0
        /// <summary>
        ///     Constructor for creating a Condition with the given binding declaration.
        /// and value.
        /// </summary>
        public Condition( BindingBase binding, object conditionValue )
        {
            if( binding == null )
            {
                throw new ArgumentNullException("binding");
            }

            Binding = binding;
            Value  = conditionValue;
        }
        public ClearBindingDisposable(DependencyObject target, DependencyProperty property, BindingBase binding)
        {
            Contract.Requires(target != null);
            Contract.Requires(property != null);
            Contract.Requires(binding != null);

            m_Target = target;
            m_Property = property;
            m_Binding = binding;
        }
Пример #7
0
    public Column( string fieldName, object title, BindingBase displayMemberBinding )
      : base( fieldName, title )
    {
      // Disable warning for DisplayMemberBinding when internaly used
#pragma warning disable 618

      this.DisplayMemberBinding = displayMemberBinding;

#pragma warning restore 618
    }
 public void Dispose()
 {
     if (m_Target == null) throw new ObjectDisposedException("ClearBindingDisposable");
     if (object.ReferenceEquals(BindingOperations.GetBindingBase(m_Target, m_Property), m_Binding))
     {
         BindingOperations.ClearBinding(m_Target, m_Property);
     }
     m_Target = null;
     m_Property = null;
     m_Binding = null;
 }
 private static void ApplyBinding(BindingBase binding, DependencyObject target, DependencyProperty property)
 {
     if (binding != null)
     {
         BindingOperations.SetBinding(target, property, binding);
     }
     else
     {
         BindingOperations.ClearBinding(target, property);
     }
 }
Пример #10
0
        /// <summary>
        /// Gets the binding value.
        /// </summary>
        /// <param name="frameworkElement">The dependency object.</param>
        /// <param name="binding">The binding.</param>
        /// <returns>The actual binding value.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="frameworkElement"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="binding"/> is <c>null</c>.</exception>
        public static object GetBindingValue(FrameworkElement frameworkElement, BindingBase binding)
        {
            Argument.IsNotNull("frameworkElement", frameworkElement);
            Argument.IsNotNull("binding", binding);

            var evaluator = new BindingEvaluator(frameworkElement.DataContext);
            BindingOperations.SetBinding(evaluator, BindingEvaluator.ValueProperty, binding);
            object value = evaluator.Value;
            ClearBinding(evaluator, BindingEvaluator.ValueProperty);

            return value;
        }
 override public bool CanWorkWithBinding(System.Windows.Data.BindingBase binding)
 {
     if (binding != null && binding is System.Windows.Data.MultiBinding)
     {
         System.Windows.Data.MultiBinding bind = binding as System.Windows.Data.MultiBinding;
         if (bind.Converter is ScriptConverter == false)
         {
             return(false);
         }
         return(true);
     }
     return(false);
 }
Пример #12
0
 /// <summary>
 /// Evaluates a WPF data binding.
 /// </summary>
 /// <param name="dataContext">The data context.</param>
 /// <param name="binding">The binding to evaluate.</param>
 /// <returns></returns>
 public static object EvaluateBinding(BindingBase binding, object dataContext)
 {
     var result = default(object);
     if (dataContext != null)
     {
         var target = new TemporaryBindingTarget();
         var duplicatedBinding = CloneBinding(binding, dataContext);
         var expression = BindingOperations.SetBinding(target, TemporaryBindingTarget.ResultProperty,
                                                       duplicatedBinding);
         expression.UpdateTarget();
         result = target.Result;
         BindingOperations.ClearBinding(target, TemporaryBindingTarget.ResultProperty);
     }
     return result;
 }
Пример #13
0
        //----------------------------------------------------- 
        // 
        //  Public Methods
        // 
        //-----------------------------------------------------

        /// <summary>
        /// Attach a BindingExpression to a property. 
        /// </summary>
        /// <remarks> 
        /// A new BindingExpression is created from the given description, and attached to 
        /// the given property of the given object.  This method is the way to
        /// attach a Binding to an arbitrary DependencyObject that may not expose 
        /// its own SetBinding method.
        /// </remarks>
        /// <param name="target">object on which to attach the Binding</param>
        /// <param name="dp">property to which to attach the Binding</param> 
        /// <param name="binding">description of the Binding</param>
        /// <exception cref="ArgumentNullException"> target and dp and binding cannot be null </exception> 
        public static BindingExpressionBase SetBinding(DependencyObject target, DependencyProperty dp, BindingBase binding) 
        {
            if (target == null) 
                throw new ArgumentNullException("target");
            if (dp == null)
                throw new ArgumentNullException("dp");
            if (binding == null) 
                throw new ArgumentNullException("binding");
//            target.VerifyAccess(); 
 
            BindingExpressionBase bindExpr = binding.CreateBindingExpression(target, dp);
 
            //

            target.SetValue(dp, bindExpr);
 
            return bindExpr;
        } 
Пример #14
0
        private static DataGridColumn CreateColumn(HeaderValue value)
        {
            //todo Sergey: Создать колонки нужного типа
            AbsM.IFieldM field = value.Header as AbsM.IFieldM;
            System.Windows.Data.BindingBase bindBase = null;

            switch (field.Type)
            {
            case Rekod.DataAccess.AbstractSource.Model.EFieldType.Date:
            {
                bindBase = new Binding(string.Format("[{0}]", value.Name))
                {
                    StringFormat = "yyyy-MM-dd"
                };
                break;
            }

            case Rekod.DataAccess.AbstractSource.Model.EFieldType.DateTime:
            {
                bindBase = new Binding(string.Format("[{0}]", value.Name))
                {
                    StringFormat = "yyyy-MM-dd HH:mm:ss"
                };
                break;
            }

            default:
            {
                bindBase = new Binding(string.Format("[{0}]", value.Name));
                if (value.IsReadOnly)
                {
                    (bindBase as Binding).Mode = BindingMode.OneWay;
                }
                break;
            }
            }

            return(new DataGridTextColumn
            {
                Header = field.Text,
                Binding = bindBase,
                SortMemberPath = value.Name
            });
        }
Пример #15
0
		public static BindingExpressionBase SetBinding (DependencyObject target, DependencyProperty dp, BindingBase binding)
		{
			if (target == null)
				throw new ArgumentNullException ("target");
			if (dp == null)
				throw new ArgumentNullException ("dp");
			if (binding == null)
				throw new ArgumentNullException ("binding");


			if (dp == null)
				throw new ArgumentNullException ("dp");
			if (binding == null)
				throw new ArgumentNullException ("binding");

			BindingExpression e = new BindingExpression ((Binding) binding, target, dp);
			target.SetValue (dp, e);
			return e;
		}
        override public bool CanWorkWithBinding(System.Windows.Data.BindingBase binding)
        {
            if (binding != null && binding is System.Windows.Data.Binding)
            {
                System.Windows.Data.Binding bind = binding as System.Windows.Data.Binding;
                if (bind.Source is ChannelDataProvider == false)
                {
                    return(false);
                }

                if (bind.Converter is SolidBrushConverter == false)
                {
                    return(false);
                }

                return(true);
            }

            return(false);
        }
Пример #17
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            SavePanelStateAndClose();
            if (activeBindings.Count > 0)
            {
                foreach (PropertyWrapper key in activeBindings.Keys)
                {
                    DependencyObject   depObj;
                    DependencyProperty depProp;
                    System.Windows.Data.BindingBase binding = activeBindings[key];

                    if (key.GetWpfObjects(out depObj, out depProp) && binding != null)
                    {
                        BindingOperations.SetBinding(depObj, depProp, binding);
                    }
                }
            }
            DialogResult = DialogResult.OK;
            Close();
        }
Пример #18
0
        public static Binding CloneBinding(BindingBase bindingBase, object source)
        {
            var binding = bindingBase as Binding;
            if (binding != null)
            {
                var result = new Binding
                {
                    Source = source,
                    AsyncState = binding.AsyncState,
                    BindingGroupName = binding.BindingGroupName,
                    BindsDirectlyToSource = binding.BindsDirectlyToSource,
                    Converter = binding.Converter,
                    ConverterCulture = binding.ConverterCulture,
                    ConverterParameter = binding.ConverterCulture,
                    //ElementName = binding.ElementName,
                    FallbackValue = binding.FallbackValue,
                    IsAsync = binding.IsAsync,
                    Mode = binding.Mode,
                    NotifyOnSourceUpdated = binding.NotifyOnSourceUpdated,
                    NotifyOnTargetUpdated = binding.NotifyOnTargetUpdated,
                    NotifyOnValidationError = binding.NotifyOnValidationError,
                    Path = binding.Path,
                    //RelativeSource = binding.RelativeSource,
                    StringFormat = binding.StringFormat,
                    TargetNullValue = binding.TargetNullValue,
                    UpdateSourceExceptionFilter = binding.UpdateSourceExceptionFilter,
                    UpdateSourceTrigger = binding.UpdateSourceTrigger,
                    ValidatesOnDataErrors = binding.ValidatesOnDataErrors,
                    ValidatesOnExceptions = binding.ValidatesOnExceptions,
                    XPath = binding.XPath,

                };
                foreach (var validationRule in binding.ValidationRules)
                {
                    result.ValidationRules.Add(validationRule);
                }
                return result;
            }
            return null;
        }
Пример #19
0
        /// <summary>
        /// Clones a binding and assigns a different data context.
        /// </summary>
        /// <param name="original">The original.</param>
        /// <param name="replacementDataContext">The replacement data context.</param>
        /// <returns></returns>
        private static BindingBase CloneBinding(BindingBase original, object replacementDataContext)
        {
            if (original is Binding)
            {
                var originalBinding = (Binding) original;
                var duplicate = new Binding();
                duplicate.BindsDirectlyToSource = originalBinding.BindsDirectlyToSource;
                duplicate.Converter = originalBinding.Converter;
                duplicate.ConverterCulture = originalBinding.ConverterCulture;
                duplicate.ConverterParameter = originalBinding.ConverterParameter;
                duplicate.FallbackValue = originalBinding.FallbackValue;
                duplicate.IsAsync = originalBinding.IsAsync;
                duplicate.Mode = originalBinding.Mode;
                duplicate.Path = originalBinding.Path;
                // Decide on a source
                if (originalBinding.RelativeSource != null) duplicate.RelativeSource = originalBinding.RelativeSource;
                else if (originalBinding.ElementName != null) duplicate.ElementName = originalBinding.ElementName;
                else duplicate.Source = replacementDataContext;

                return duplicate;
            }
            throw new NotSupportedException();
        }
Пример #20
0
        public override void Initialize(object element, PropertyWrapper property, System.Windows.Data.BindingBase binding)
        {
            base.Initialize(element, property, binding);

            System.Windows.Data.Binding bind = binding as System.Windows.Data.Binding;
            if (bind != null)
            {
                ChannelDataProvider cdp = (ChannelDataProvider)bind.Source;
                AddChannel(cdp.Channel);

                ComposingConverter conv = bind.Converter as ComposingConverter;
                foreach (IValueConverter converter in conv.Converters)
                {
                    if (converter is RangeConverter)
                    {
                        checkBox1.Checked = true;
                        RangeConverter rc = converter as RangeConverter;
                        minEdit.Value = (Decimal)rc.Min;
                        maxEdit.Value = (Decimal)rc.Max;
                    }
                }
            }
        }
        public override void Initialize(object element, PropertyWrapper property, System.Windows.Data.BindingBase binding)
        {
            base.Initialize(element, property, binding);

            System.Windows.Data.Binding bind = binding as System.Windows.Data.Binding;
            if (bind != null)
            {
                ChannelDataProvider cdp = (ChannelDataProvider)bind.Source;
                AddChannel(cdp.Channel);
                SolidBrushConverter sbc = bind.Converter as SolidBrushConverter;
                minEdit.Value = (Decimal)sbc.MinValue;
                maxEdit.Value = (Decimal)sbc.MaxValue;
                startColorButton.BackColor = Color.FromArgb(
                    sbc.StartColor.A,
                    sbc.StartColor.R,
                    sbc.StartColor.G,
                    sbc.StartColor.B);
                endColorButton.BackColor = Color.FromArgb(
                    sbc.EndColor.A,
                    sbc.EndColor.R,
                    sbc.EndColor.G,
                    sbc.EndColor.B);
            }
        }
Пример #22
0
        /// <summary>
        /// BooleanTreeColumn 用于显示的元素也直接是一个 CheckBox
        /// </summary>
        /// <param name="binding"></param>
        /// <returns></returns>
        protected override FrameworkElementFactory GenerateDefaultDisplayTemplate(BindingBase binding)
        {
            var cb = new FrameworkElementFactory(typeof(CheckBox));

            cb.SetBinding(CheckBox.IsCheckedProperty, binding);

            var style = this.DisplayCheckBoxStyle;
            if (style != null) cb.SetValue(CheckBox.StyleProperty, style);

            //把 TreeGrid.IsReadOnly 属性反向绑定到 IsEanbled 属性上。
            //这是由于这个列直接使用显示的控件作为编辑的控件,所以这个显示控件的只读性,需要与 TreeGrid 的只读性保持同步。
            cb.SetBinding(CheckBox.IsEnabledProperty, new Binding
            {
                Path = new PropertyPath(TreeGrid.IsReadOnlyProperty),
                Converter = new ReverseBooleanConverter(),
                RelativeSource = new RelativeSource
                {
                    Mode = RelativeSourceMode.FindAncestor,
                    AncestorType = typeof(TreeGrid)
                }
            });

            return cb;
        }
        public override void Initialize(object element, PropertyWrapper property, System.Windows.Data.BindingBase binding)
        {
            base.Initialize(element, property, binding);

            DependencyObject   depObj;
            DependencyProperty depProp;

            if (property.GetWpfObjects(out depObj, out depProp))
            {
                if (depObj.GetValue(depProp) is String)
                {
                    expressionEdit.Text = (string)depObj.GetValue(depProp);
                }
            }

            System.Windows.Data.MultiBinding bind = binding as System.Windows.Data.MultiBinding;
            if (bind != null)
            {
                expressionEdit.Text = (bind.Converter as ScriptConverter).Expression;

                channels.Clear();
                foreach (System.Windows.Data.BindingBase bindingBase in bind.Bindings)
                {
                    if (bindingBase is System.Windows.Data.Binding)
                    {
                        System.Windows.Data.Binding b = bindingBase as System.Windows.Data.Binding;
                        if (b.Source is ChannelDataProvider)
                        {
                            ChannelDataProvider src = (ChannelDataProvider)b.Source;
                            channels.Add(src.Channel);
                        }
                    }
                }
                FillChannelsGrid();
            }
        }
Пример #24
0
 /// <summary>
 ///     Called when SelectedItemBinding changes. 
 /// </summary> 
 /// <param name="oldBinding">The old binding.</param>
 /// <param name="newBinding">The new binding.</param> 
 protected virtual void OnSelectedItemBindingChanged(BindingBase oldBinding, BindingBase newBinding)
 {
     NotifyPropertyChanged("SelectedItemBinding");
 } 
 void SetConnectorLabelToolTip(Connector connector, BindingBase binding)
 {
     connector.SetBinding(Connector.LabelTextProperty, binding);
     ToolTip toolTip = new ToolTip();
     toolTip.SetBinding(UserControl.ContentProperty, binding);
     connector.SetLabelToolTip(toolTip);
 }
 static void SetSelectedValueBinding_RestoreAfterInitialization(Selector element, BindingBase value)
 {
     element.SetValue(SelectedValueBinding_RestoreAfterInitializationProperty, value);
 }
Пример #27
0
 // Token: 0x06001806 RID: 6150 RVA: 0x00074489 File Offset: 0x00072689
 internal override ValidationRule LookupValidationRule(Type type)
 {
     return(BindingBase.LookupValidationRule(type, this.ValidationRulesInternal));
 }
        private static void ApplyDataBinding( FrameworkElement element, string dependencyProperty, BindingBase binding )
        {
            Contract.Requires( element != null );
            Contract.Requires( !string.IsNullOrEmpty( dependencyProperty ) );
            Contract.Requires( binding != null );

            // find matching dependency property (search local type and all base types)
            var fields = from type in GetTypeIterator( element.GetType() )
                         from dp in type.GetFields()
                         where dp.IsStatic &&
                               dp.IsInitOnly &&
                               dp.FieldType == typeof( DependencyProperty ) &&
                               StringComparer.Ordinal.Equals( dp.Name, dependencyProperty )
                         select dp;
            var field = fields.FirstOrDefault();

            // the dependency property wasn't found
            if ( field == null )
            {
                var message = ExceptionMessage.MissingDependencyProperty.FormatDefault( element.GetType(), dependencyProperty );
                System.Diagnostics.Debug.WriteLine( message );
                System.Console.WriteLine( message );
                return;
            }

            // dynamically data bind
            element.SetBinding( (DependencyProperty) field.GetValue( null ), binding );
        }
 /// <summary>
 ///     Set up data binding on template child
 /// </summary>
 /// <param name="dp">Dependent property</param>
 /// <param name="binding">Description of binding</param>
 public void SetBinding(DependencyProperty dp, BindingBase binding)
 {
     // store Binding in the style - this will get converted to Binding
     // on demand (see Style.ProcessApplyValuesHelper)
     SetValue(dp, binding);
 }
Пример #30
0
 internal void      CopyValue(Feature id, BindingBase clone) { if (HasValue(id)) { clone.SetValue(id, GetValue(id, null)); } }
Пример #31
0
    private static bool VerifyDisplayMemberBinding( BindingBase binding )
    {
      bool retval = false;
      //a DataCell can only be recycled if the DisplayMemberBinding is of type Binding
      //and have no source, relativesource, elementname

      Binding displayMemberBinding = binding as Binding;

      if( displayMemberBinding != null )
      {
        if( ( ( displayMemberBinding.Source == null ) || ( displayMemberBinding.Source == DependencyProperty.UnsetValue ) )
          && ( ( displayMemberBinding.RelativeSource == null ) || ( displayMemberBinding.Source == DependencyProperty.UnsetValue ) )
          && ( string.IsNullOrEmpty( displayMemberBinding.ElementName ) == true ) )
        {
          retval = true;
        }
      }

      return retval;
    }
Пример #32
0
 public static T ClipboardContentBinding <T>(this T target, Data.BindingBase value) where T : DataGridColumn
 {
     target.ClipboardContentBinding = value;
     return(target);
 }
Пример #33
0
            public bool Capture(Point pt)
            {
                this.tub = get_tier_ui(pt);
                if (tub == null /*|| tub.TiersControl.Items.Count == 1*/)
                    return false;

                pt.X = 0.0;
                pp_offs = mg.TransformToDescendant(tub).Transform(pt);
                pp_offs.X += tub.Margin.Left;
                pp_offs.Y += tub.Margin.Top;

                var sz = new Size(tub.ActualWidth, tub.ActualHeight);

                this.tui = new Rectangle
                {
                    Fill = new ImageBrush
                    {
                        ImageSource = __util.GetImage(tub, null, sz),
                        Stretch = Stretch.None
                    },
                    Width = sz.Width,
                    Height = sz.Height,
                    Margin = tub.Margin,
                };

                this.bb = BindingOperations.GetBinding(tub, VisibilityProperty);
                BindingOperations.ClearBinding(tub, VisibilityProperty);
                tub.Visibility = Visibility.Hidden;

                mg.Children.Add(tui);

                return tui.CaptureMouse();
            }
Пример #34
0
 public static void SetSortBindingMember(DependencyObject obj, BindingBase value)
 {
     obj.SetValue(SortBindingMemberProperty, value);
 }
Пример #35
0
        /// <summary>
        /// 生成一个默认的控件模板,用于显示。
        /// 
        /// 这个模板的绑定是动态的,所以无法放到 xaml 中去定义,只能用代码动态生成。
        /// </summary>
        /// <returns></returns>
        protected virtual FrameworkElementFactory GenerateDefaultDisplayTemplate(BindingBase binding)
        {
            var textBlock = new FrameworkElementFactory(typeof(TextBlock));

            textBlock.SetBinding(TextBlock.TextProperty, binding);

            var style = this.DisplayTextBlockStyle;
            if (style != null) textBlock.SetValue(TextBlock.StyleProperty, style);

            return textBlock;
        }
Пример #36
0
        internal override void InitializeClone(BindingBase baseClone, BindingMode mode)
        {
            Binding clone = (Binding)baseClone;
 
            clone._ppath = _ppath;
            clone._xpath = _xpath; 
            clone._source = _source; 
            clone._culture = _culture;
            clone._isAsync = _isAsync; 
            clone._asyncState = _asyncState;
            clone._bindsDirectlyToSource = _bindsDirectlyToSource;
            clone._doesNotTransferDefaultValue = _doesNotTransferDefaultValue;
            clone._objectSource = _objectSource; 
            clone._relativeSource = _relativeSource;
            clone._converter = _converter; 
            clone._converterParameter = _converterParameter; 
            clone._attachedPropertiesInPath = _attachedPropertiesInPath;
            clone._validationRules = _validationRules; 

            base.InitializeClone(baseClone, mode);
        }
Пример #37
0
 /// <summary> 
 ///     Called when TextBinding changes. 
 /// </summary>
 /// <param name="oldBinding">The old binding.</param> 
 /// <param name="newBinding">The new binding.</param>
 protected virtual void OnTextBindingChanged(BindingBase oldBinding, BindingBase newBinding)
 {
     NotifyPropertyChanged("TextBinding"); 
 }
Пример #38
0
        // initialize a clone
        internal virtual void InitializeClone(BindingBase clone, BindingMode mode)
        {
            clone._flags = _flags;
            CopyValue(Feature.FallbackValue, clone);
            clone._isSealed = _isSealed;
            CopyValue(Feature.StringFormat, clone);
            CopyValue(Feature.TargetNullValue, clone);
            CopyValue(Feature.BindingGroupName, clone);

            clone.ChangeFlagsWithinMask(BindingFlags.PropagationMask, FlagsFrom(mode));
        }
        //------------------------------------------------------
        //
        //  Public Methods
        //
        //------------------------------------------------------

        /// <summary>
        /// Attach a BindingExpression to a property.
        /// </summary>
        /// <remarks>
        /// A new BindingExpression is created from the given description, and attached to
        /// the given property of the given object.  This method is the way to
        /// attach a Binding to an arbitrary DependencyObject that may not expose
        /// its own SetBinding method.
        /// </remarks>
        /// <param name="target">object on which to attach the Binding</param>
        /// <param name="dp">property to which to attach the Binding</param>
        /// <param name="binding">description of the Binding</param>
        /// <exception cref="ArgumentNullException"> target and dp and binding cannot be null </exception>
        public static BindingExpressionBase SetBinding(DependencyObject target, DependencyProperty dp, BindingBase binding)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            if (dp == null)
            {
                throw new ArgumentNullException("dp");
            }
            if (binding == null)
            {
                throw new ArgumentNullException("binding");
            }
//            target.VerifyAccess();

            BindingExpressionBase bindExpr = binding.CreateBindingExpression(target, dp);

            //

            target.SetValue(dp, bindExpr);

            return(bindExpr);
        }
Пример #40
0
 /// <summary>
 /// Attach a data Binding to a property
 /// </summary> 
 /// <param name="dp">DependencyProperty that represents the property</param>
 /// <param name="binding">description of Binding to attach</param> 
 public BindingExpressionBase SetBinding(DependencyProperty dp, BindingBase binding) 
 {
     return BindingOperations.SetBinding(this, dp, binding); 
 }
Пример #41
0
            public void Release(Point pt)
            {
                var _new = get_tier_ui(pt);

                tui.ReleaseMouseCapture();
                mg.Children.Remove(tui);

                if (_new != null)
                {
                    tier_base.MoveTier(tub.Tier, _new.Tier);
                }

                tub.Visibility = Visibility.Visible;
                BindingOperations.SetBinding(tub, VisibilityProperty, bb);
                bb = null;
            }