Пример #1
0
        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);

            }
        }
Пример #2
0
 public static void SetCustomKeyBindings(FrameworkElement obj,
                                           CustomKeyBindingsCollection value)
 {
     obj.SetValue(CustomKeyBindingsProperty, value);
 }