コード例 #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);
        }
コード例 #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);
        }