Пример #1
0
        /// <summary>
        /// Retrieves the mapping collection
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        internal static InputBindingCollection InternalGetBindingCollection(DependencyObject obj)
        {
            var bindings = obj.GetValue(BindingsProperty) as InputBindingCollection;

            if (bindings == null)
            {
                bindings = new InputBindingCollection();
                SetBindings(obj, bindings);
            }
            return(bindings);
        }
Пример #2
0
 /// <summary>
 /// This changes the event mapping
 /// </summary>
 /// <param name="target"></param>
 /// <param name="e"></param>
 private static void OnBindingsChanged(DependencyObject target, DependencyPropertyChangedEventArgs e)
 {
     if (e.OldValue != null)
     {
         InputBindingCollection cec = e.OldValue as InputBindingCollection;
         if (cec != null)
         {
             cec.RemoveBindings(target);
         }
     }
     if (e.NewValue != null)
     {
         InputBindingCollection cec = e.NewValue as InputBindingCollection;
         if (cec != null)
         {
             cec.AddBindings(target);
         }
     }
 }
Пример #3
0
 /// <summary>
 /// This sets the mapping collection.
 /// </summary>
 /// <param name="obj">Dependency Object</param>
 /// <param name="value">Mapping collection</param>
 public static void SetBindings(DependencyObject obj, InputBindingCollection value)
 {
     obj.SetValue(BindingsProperty, value);
 }