Exemplo n.º 1
0
        // Note: the DependencyProperty parameter is here simply to keep the logic defined in the WPF
        // implementation and is not used here
        internal bool ProvideSelfAsInheritanceContext(DependencyObject doValue, DependencyProperty dp)
        {
            if (doValue != null &&
                this.ShouldProvideInheritanceContext(doValue, dp) &&
                this.CanBeInheritanceContext &&
                !doValue.IsInheritanceContextSealed)

            {
                if (doValue.InheritanceContext != null)
                {
                    // In silverlight, there is only one inherited context for a given DependencyObject.
                    // We can only set an inherited context if there is no inherited context for the
                    // DependencyObject.
                    return(false);
                }
                else
                {
                    doValue.AddInheritanceContext(this, dp);

                    // Context changed
                    return(true);
                }
            }
            else
            {
                return(false);
            }
        }