/// <summary>Retrieves the <see cref="T:System.Windows.Data.BindingBase" /> object that is set on the specified property.</summary>
        /// <param name="target">The object where <paramref name="dp" /> is.</param>
        /// <param name="dp">The binding target property from which to retrieve the <see cref="T:System.Windows.Data.BindingBase" /> object.</param>
        /// <returns>The <see cref="T:System.Windows.Data.BindingBase" /> object that is set on the given property or <see langword="null" /> if no binding object has been set.</returns>
        /// <exception cref="T:System.ArgumentNullException">The <paramref name="target" /> and <paramref name="dp" /> parameters cannot be <see langword="null" />.</exception>
        // Token: 0x06001A2B RID: 6699 RVA: 0x0007D0E0 File Offset: 0x0007B2E0
        public static BindingBase GetBindingBase(DependencyObject target, DependencyProperty dp)
        {
            BindingExpressionBase bindingExpressionBase = BindingOperations.GetBindingExpressionBase(target, dp);

            if (bindingExpressionBase == null)
            {
                return(null);
            }
            return(bindingExpressionBase.ParentBindingBase);
        }
        /// <summary>Returns the <see cref="T:System.Windows.Data.BindingExpression" /> object associated with the specified binding target property on the specified object.</summary>
        /// <param name="target">The binding target object where <paramref name="dp" /> is.</param>
        /// <param name="dp">The binding target property from which to retrieve the <see cref="T:System.Windows.Data.BindingExpression" /> object.</param>
        /// <returns>The <see cref="T:System.Windows.Data.BindingExpression" /> object associated with the given property or <see langword="null" /> if none exists. If a <see cref="T:System.Windows.Data.PriorityBindingExpression" /> object is set on the property, the <see cref="P:System.Windows.Data.PriorityBindingExpression.ActiveBindingExpression" /> is returned.</returns>
        /// <exception cref="T:System.ArgumentNullException">The <paramref name="target" /> and <paramref name="dp" /> parameters cannot be <see langword="null" />.</exception>
        // Token: 0x06001A30 RID: 6704 RVA: 0x0007D164 File Offset: 0x0007B364
        public static BindingExpression GetBindingExpression(DependencyObject target, DependencyProperty dp)
        {
            BindingExpressionBase     bindingExpressionBase     = BindingOperations.GetBindingExpressionBase(target, dp);
            PriorityBindingExpression priorityBindingExpression = bindingExpressionBase as PriorityBindingExpression;

            if (priorityBindingExpression != null)
            {
                bindingExpressionBase = priorityBindingExpression.ActiveBindingExpression;
            }
            return(bindingExpressionBase as BindingExpression);
        }
 /// <summary>Returns the <see cref="T:System.Windows.Data.PriorityBindingExpression" /> object associated with the specified binding target property on the specified object.</summary>
 /// <param name="target">The binding target object where <paramref name="dp" /> is.</param>
 /// <param name="dp">The binding target property from which to retrieve the <see cref="T:System.Windows.Data.PriorityBindingExpression" /> object.</param>
 /// <returns>The <see cref="T:System.Windows.Data.PriorityBindingExpression" /> object associated with the given property or <see langword="null" /> if none exists.</returns>
 /// <exception cref="T:System.ArgumentNullException">The <paramref name="target" /> and <paramref name="dp" /> parameters cannot be <see langword="null" />.</exception>
 // Token: 0x06001A32 RID: 6706 RVA: 0x0007D19E File Offset: 0x0007B39E
 public static PriorityBindingExpression GetPriorityBindingExpression(DependencyObject target, DependencyProperty dp)
 {
     return(BindingOperations.GetBindingExpressionBase(target, dp) as PriorityBindingExpression);
 }
Esempio n. 4
0
        void EnsureView(object source, Type collectionViewType)
        {
            if (_isInitializing || _deferLevel > 0)
            {
                return;
            }

            DataSourceProvider dataProvider = source as DataSourceProvider;

            // listen for DataChanged events from an DataSourceProvider
            if (dataProvider != _dataProvider)
            {
                if (_dataProvider != null)
                {
                    DataChangedEventManager.RemoveHandler(_dataProvider, OnDataChanged);
                }

                _dataProvider = dataProvider;

                if (_dataProvider != null)
                {
                    DataChangedEventManager.AddHandler(_dataProvider, OnDataChanged);
                    _dataProvider.InitialLoad();
                }
            }

            // if the source is DataSourceProvider, use its Data instead
            if (dataProvider != null)
            {
                source = dataProvider.Data;
            }

            // get the view
            ICollectionView view = null;

            if (source != null)
            {
                DataBindEngine engine     = DataBindEngine.CurrentDataBindEngine;
                ViewRecord     viewRecord = engine.GetViewRecord(source, this, collectionViewType, true,
                                                                 (object x) =>
                {
                    BindingExpressionBase beb = BindingOperations.GetBindingExpressionBase(this, SourceProperty);
                    return((beb != null) ? beb.GetSourceItem(x) : null);
                });

                if (viewRecord != null)
                {
                    view = viewRecord.View;
                    _isViewInitialized = viewRecord.IsInitialized;

                    // bring view up to date with the CollectionViewSource
                    if (_version != viewRecord.Version)
                    {
                        ApplyPropertiesToView(view);
                        viewRecord.Version = _version;
                    }
                }
            }

            // update the View property
            SetValue(ViewPropertyKey, view);
        }