private static void CustomKeyBindingsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { FrameworkElement element = d as FrameworkElement; CustomKeyBindingsCollection coll = e.NewValue as CustomKeyBindingsCollection; if (element != null && coll != null) { collection = coll; coll.Element = element; coll.DataContext = element.DataContext; element.DataContextChanged += (_1, _2) => { coll.DataContext = element.DataContext; }; element.Loaded += new RoutedEventHandler(binding_Loaded); } }
public static void SetCustomKeyBindings(FrameworkElement obj, CustomKeyBindingsCollection value) { obj.SetValue(CustomKeyBindingsProperty, value); }