Exemplo n.º 1
0
        /// <summary>
        /// Change handler for the event name
        /// </summary>
        /// <param name="dpo">VMTrigger object</param>
        /// <param name="e">EventArgs</param>
        private static void OnTargetChanged(DependencyObject dpo, DependencyPropertyChangedEventArgs e)
        {
            ViewModelTrigger vmt = (ViewModelTrigger)dpo;

            object oldTarget = e.OldValue;

            if (oldTarget != null)
            {
                vmt.Unregister(oldTarget, vmt.EventName);
            }
            vmt.Register(vmt.Target, vmt.EventName);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Change handler for the event name
        /// </summary>
        /// <param name="dpo">VMTrigger object</param>
        /// <param name="e">EventArgs</param>
        private static void OnEventNameChanged(DependencyObject dpo, DependencyPropertyChangedEventArgs e)
        {
            ViewModelTrigger vmt = (ViewModelTrigger)dpo;

            string oldEventName = e.OldValue as string;

            if (!string.IsNullOrEmpty(oldEventName))
            {
                vmt.Unregister(vmt.Target, oldEventName);
            }
            vmt.Register(vmt.Target, vmt.EventName);
        }