When placed into an element's Resources collection the spy's Element property returns that containing element. Use the NameScopeSource attached property to bridge an element's NameScope to other elements.
상속: System.Windows.Freezable
예제 #1
0
        static void OnNameScopeSourceChanged(
            DependencyObject depObj,
            DependencyPropertyChangedEventArgs e)
        {
            ElementSpy spy = e.NewValue as ElementSpy;

            if (spy == null || spy.Element == null)
            {
                return;
            }

            INameScope scope =
                NameScope.GetNameScope(spy.Element);

            if (scope == null)
            {
                return;
            }

            depObj.Dispatcher.BeginInvoke(
                DispatcherPriority.Normal,
                (Action) delegate
            {
                NameScope.SetNameScope(depObj, scope);
            });
        }
예제 #2
0
 public static void SetNameScopeSource(
     DependencyObject obj, ElementSpy value)
 {
     obj.SetValue(NameScopeSourceProperty, value);
 }
예제 #3
0
 public static void SetNameScopeSource(
     DependencyObject obj, ElementSpy value)
 {
     obj.SetValue(NameScopeSourceProperty, value);
 }