using System.Windows.Interactivity;
using Telerik.Windows.Controls;

namespace CustomKeyboardCommandProvider_WPF
{
	public class CustomKeyboardCommandBehavior : Behavior<RadGridView>
	{
		protected override void OnAttached()
		{
			base.OnAttached();
			this.AssociatedObject.Loaded += new System.Windows.RoutedEventHandler(AssociatedObject_Loaded);
		}

		void AssociatedObject_Loaded(object sender, System.Windows.RoutedEventArgs e)
		{
			this.AssociatedObject.KeyboardCommandProvider = new CustomKeyboardCommandProvider(this.AssociatedObject);
		}

		protected override void OnDetaching()
		{
			base.OnDetaching();
			this.AssociatedObject.Loaded -= new System.Windows.RoutedEventHandler(AssociatedObject_Loaded);
		}
	}
}
