Example #1
0
        // internal version of FindName that returns the scope owner
        internal object FindName(string name, out DependencyObject scopeOwner)
        {
            INameScope nameScope = FrameworkElement.FindScope(this, out scopeOwner);

            if (nameScope != null)
            {
                return(nameScope.FindName(name));
            }

            return(null);
        }
Example #2
0
        /// <summary>
        /// Unregisters the name - element combination from the
        /// NameScope that the current element belongs to.
        /// </summary>
        /// <param name="name">Name of the element</param>
        public void UnregisterName(string name)
        {
            INameScope nameScope = FrameworkElement.FindScope(this);

            if (nameScope != null)
            {
                nameScope.UnregisterName(name);
            }
            else
            {
                throw new InvalidOperationException(SR.Get(SRID.NameScopeNotFound, name, "unregister"));
            }
        }