當前位置: 首頁>>代碼示例>>C#>>正文


C# Data.BindingBase類代碼示例

本文整理匯總了C#中System.Windows.Data.BindingBase的典型用法代碼示例。如果您正苦於以下問題:C# BindingBase類的具體用法?C# BindingBase怎麽用?C# BindingBase使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BindingBase類屬於System.Windows.Data命名空間,在下文中一共展示了BindingBase類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetDisplayMemberBinding

    internal void SetDisplayMemberBinding( BindingBase value )
    {
      // Disable warning for DisplayMemberBinding when internaly used
#pragma warning disable 618
      this.DisplayMemberBinding = value;
#pragma warning restore 618
    }
開發者ID:austinedeveloper,項目名稱:WpfExtendedToolkit,代碼行數:7,代碼來源:Column.cs

示例2: ConditionItem

        /// <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();
        }
開發者ID:bdurrani,項目名稱:WPF-Inspector,代碼行數:11,代碼來源:ConditionItem.cs

示例3: Create

    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;
    }
開發者ID:austinedeveloper,項目名稱:WpfExtendedToolkit,代碼行數:9,代碼來源:Column.cs

示例4: Column

    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
    }
開發者ID:Torion,項目名稱:WpfExToolkit,代碼行數:10,代碼來源:Column.cs

示例5: ClearBindingDisposable

        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;
        }
開發者ID:pixelmeister,項目名稱:CodeBinding,代碼行數:10,代碼來源:ClearBindingDisposable.cs

示例6: Condition

        /// <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;
        }
開發者ID:JianwenSun,項目名稱:cc,代碼行數:14,代碼來源:Condition.cs

示例7: Dispose

 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;
 }
開發者ID:pixelmeister,項目名稱:CodeBinding,代碼行數:11,代碼來源:ClearBindingDisposable.cs

示例8: ApplyBinding

 private static void ApplyBinding(BindingBase binding, DependencyObject target, DependencyProperty property)
 {
     if (binding != null)
     {
         BindingOperations.SetBinding(target, property, binding);
     }
     else
     {
         BindingOperations.ClearBinding(target, property);
     }
 }
開發者ID:GeertvanHorrik,項目名稱:MahApps.Metro,代碼行數:11,代碼來源:DataGridNumericUpDownColumn.cs

示例9: GetBindingValue

        /// <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;
        }
開發者ID:justdude,項目名稱:DbExport,代碼行數:20,代碼來源:BindingHelper.cs

示例10: EvaluateBinding

 /// <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;
 }
開發者ID:PaulStovell,項目名稱:bindable,代碼行數:21,代碼來源:BindingHelper.cs

示例11: SetBinding

        //----------------------------------------------------- 
        // 
        //  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;
        } 
開發者ID:sjyanxin,項目名稱:WPFSource,代碼行數:37,代碼來源:BindingOperations.cs

示例12: SetBinding

		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;
		}
開發者ID:dfr0,項目名稱:moon,代碼行數:19,代碼來源:BindingOperations.cs

示例13: CloneBinding

        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;
        }
開發者ID:Easy-DDI-Organizer,項目名稱:EDO,代碼行數:40,代碼來源:PropertyPathHelper.cs

示例14: CloneBinding

        /// <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();
        }
開發者ID:PaulStovell,項目名稱:bindable,代碼行數:29,代碼來源:BindingHelper.cs

示例15: GenerateDefaultDisplayTemplate

        /// <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;
        }
開發者ID:569550384,項目名稱:Rafy,代碼行數:29,代碼來源:BooleanTreeColumn.cs


注:本文中的System.Windows.Data.BindingBase類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。