Beispiel #1
0
        protected void AddEventHandler(IEventHandler handler)
        {
            if (eventHandlers.IsNull())
            {
                eventHandlers = new EventHandlerList();
            }

            eventHandlers.Add(handler);
        }
Beispiel #2
0
        private static void AttachChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            if (DesignModeUtility.DesignModeIsEnabled)
            {
                return;
            }

            string attachString = dependencyPropertyChangedEventArgs.NewValue as string;

            if (!string.IsNullOrWhiteSpace(attachString))
            {
                EventHandlerList handlerHelpers = new EventHandlerList();
                string[] attachStrings = attachString.Split(';');

                foreach (string s in attachStrings)
                {
                    var trimString = s.Trim();

                    if (!string.IsNullOrEmpty(trimString))
                    {
                        var newHandler = new EventHandlerInstance { Attach = trimString };

                        handlerHelpers.Add(newHandler);
                    }
                }

                SetList(dependencyObject, handlerHelpers);
            }
        }