Beispiel #1
0
        private static void OnCommandStadeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (_isIn)
            {
                return;
            }

            var root = ControlLogic.FindRoot(d);

            if (root == null)
            {
                return;
            }

            var name = GetCommand(d);

            BindInternal(name, name, root, d);
        }
Beispiel #2
0
        private static void OnEventsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(d))
            {
                return;
            }

            var root = ControlLogic.FindRoot(d);

            if (root == null)
            {
                if (d is FrameworkElement element)
                {
                    ControlLogic.MakeLazy(element, e.NewValue as string, e.OldValue as string, BindInternal);
                }
                return;
            }

            BindInternal(e.OldValue as string, e.NewValue as string, root, d);
        }
Beispiel #3
0
        private static void SetLinker(DependencyObject obj, string?oldName, string?newName, Func <LinkerBase> factory)
        {
            if (string.IsNullOrWhiteSpace(newName))
            {
                return;
            }

            Argument.NotNull(obj, nameof(obj));
            Argument.NotNull(factory, nameof(factory));
            if (DesignerProperties.GetIsInDesignMode(obj))
            {
                return;
            }

            var root = ControlLogic.FindRoot(obj);

            if (root == null)
            {
                return;
            }

            if (oldName != null)
            {
                root.CleanUp(ControlHelperPrefix + oldName);
            }

            if (newName == null)
            {
                return;
            }

            var linker = factory();

            linker.Name = newName;
            root.Register(ControlHelperPrefix + newName, linker, obj);
        }