Пример #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);
 }