private static void OnEventsChanged(Control d, string newValue, string?oldValue) { var ele = ElementMapper.Create(d); var rootOption = ControlBindLogic.FindRoot(ele.AsOption()); rootOption.Run( root => BindInternal(oldValue, newValue, root, ele), () => ControlBindLogic.MakeLazy((IUIElement)ele, newValue, oldValue, BindInternal)); }
private static void SetLinker(AvaloniaObject obj, string?oldName, string?newName, Func <LinkerBase> factory) { if (string.IsNullOrWhiteSpace(newName)) { return; } Argument.NotNull(obj, nameof(obj)); Argument.NotNull(factory, nameof(factory)); var ele = ElementMapper.Create(obj); var rootOption = ControlBindLogic.FindRoot(ele.AsOption()); rootOption.Run( root => SetLinker(newName, oldName, root, ele, factory), () => ControlBindLogic.MakeLazy((IUIElement)ele, newName, oldName, (name, old, controllable, dependencyObject) => SetLinker(old, name, controllable, dependencyObject, factory))); }
private static void OnEventsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (DesignerProperties.GetIsInDesignMode(d)) { return; } var root = ControlBindLogic.FindRoot(May(d)); if (root.IsNothing()) { if (d is FrameworkElement element) { ControlBindLogic.MakeLazy(element, MayNotEmpty(e.NewValue as string), MayNotEmpty(e.OldValue as string), BindInternal); } return; } BindInternal(MayNotEmpty(e.OldValue as string), MayNotEmpty(e.NewValue as string), root, d); }
private static void OnEventsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (DesignerProperties.GetIsInDesignMode(d)) { return; } var ele = ElementMapper.Create(d); var rootOption = ControlBindLogic.FindRoot(ele.AsOption()); rootOption.Run( root => BindInternal(e.OldValue as string, e.NewValue as string, root, ele), () => { if (d is FrameworkElement) { ControlBindLogic.MakeLazy((IUIElement)ele, e.NewValue as string, e.OldValue as string, BindInternal); } }); }
private static void SetLinker(DependencyObject obj, Maybe <string> oldName, Maybe <string> newName, Func <LinkerBase> factory) { if (newName.IsNothing()) { return; } if (DesignerProperties.GetIsInDesignMode(obj)) { return; } var root = ControlBindLogic.FindRoot(May(obj)); if (root.IsNothing()) { ControlBindLogic.MakeLazy((FrameworkElement)obj, newName, oldName, (name, old, controllable, dependencyObject) => SetLinker(old, name, controllable, dependencyObject, factory)); return; } SetLinker(newName, oldName, root, obj, factory); }