private static void Register(DataContextBridge bridge)
 {
     if (!registeredBridges.Contains(bridge))
     {
         registeredBridges.Add(bridge);
     }
 }
 private static void Unregister(DataContextBridge bridge)
 {
     if (registeredBridges.Contains(bridge))
     {
         registeredBridges.Remove(bridge);
     }
 }
        private static void SourceScopeNameChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            string name = e.NewValue as string;

            if (sender is FrameworkElement target && !String.IsNullOrWhiteSpace(name))
            {
                DataContextBridge bridge = registeredBridges.FirstOrDefault(b => b.ScopeName == name);
                if (bridge != null)
                {
                    target.SetBinding(DataContextProperty, new Binding {
                        Source = bridge, Path = new PropertyPath(DataContextProperty), Mode = BindingMode.OneWay
                    });
                }
                else
                {
                    registeredTargets.Add(target);
                }
            }
        }