Hi,

I was just trying to capture left arrow and right arrow key movement over the text in wpf textbox. I implemented a wpf attached behaviour for the textbox and bound PreviewKeyDown event.

Although, it's capturing all other keys(including Enter,backspace, shift) but it's not capturing the arrow keys.

Can anyone tell me why it's like that?

Thanks in advance.

Below is the function where I am binding it..

private static void OnHandleKeysUp(DependencyObject d,
DependencyPropertyChangedEventArgs e)
{
if (d is UIElement)
{
UIElement element = d as UIElement;

if (element != null)
{
if ((bool)e.NewValue)
{
element.PreviewKeyDown -= OnPreviewKeysDown;
element.PreviewKeyDown += OnPreviewKeysDown;

element.KeyUp -= OnKeysUp;
element.KeyUp += OnKeysUp;

element.GotFocus-= OnGotFocus;
element.GotFocus+= OnGotFocus;

}
}
}
}