Exemplo n.º 1
0
        // Token: 0x060048E1 RID: 18657 RVA: 0x0014AC70 File Offset: 0x00148E70
        private static DependencyObject FindContextElement(BindingExpressionBase beb)
        {
            BindingExpression bindingExpression;

            if ((bindingExpression = (beb as BindingExpression)) != null)
            {
                return(bindingExpression.ContextElement);
            }
            ReadOnlyCollection <BindingExpressionBase> readOnlyCollection = null;
            MultiBindingExpression    multiBindingExpression;
            PriorityBindingExpression priorityBindingExpression;

            if ((multiBindingExpression = (beb as MultiBindingExpression)) != null)
            {
                readOnlyCollection = multiBindingExpression.BindingExpressions;
            }
            else if ((priorityBindingExpression = (beb as PriorityBindingExpression)) != null)
            {
                readOnlyCollection = priorityBindingExpression.BindingExpressions;
            }
            if (readOnlyCollection != null)
            {
                foreach (BindingExpressionBase beb2 in readOnlyCollection)
                {
                    DependencyObject dependencyObject = DataGridHelper.FindContextElement(beb2);
                    if (dependencyObject != null)
                    {
                        return(dependencyObject);
                    }
                }
            }
            return(null);
        }
Exemplo n.º 2
0
        // Token: 0x060048E0 RID: 18656 RVA: 0x0014AC24 File Offset: 0x00148E24
        internal static bool BindingExpressionBelongsToElement <T>(BindingExpressionBase beb, T element) where T : FrameworkElement
        {
            DependencyObject targetElement = beb.TargetElement;

            if (targetElement != null)
            {
                DependencyObject dependencyObject = DataGridHelper.FindContextElement(beb);
                if (dependencyObject == null)
                {
                    dependencyObject = targetElement;
                }
                if (dependencyObject is Visual || dependencyObject is Visual3D)
                {
                    return(VisualTreeHelper.IsAncestorOf(element, dependencyObject, typeof(T)));
                }
            }
            return(false);
        }