This project has moved and is read-only. For the latest updates, please go here.

Richtextbox keydown/previewkeydown events

Mar 9, 2011 at 2:52 PM

I have a data grid with two columns that use RichTextBoxes. I would like to catch the cursordown key event when typing. I have tried the RichTextBox PreviewKeyDown and KeyDown, but none of them are being fired?? Any ideas why that is? Once I get this working, will i be able to find out that I am at the end of the richtextbox text, thus I move down to the next datagrid row rather than down in the richtextbox?


Mar 9, 2011 at 4:21 PM

This works for me:

        <DataGrid ItemsSource="{Binding}">
                <DataGridTemplateColumn Header="Name">
                            <extToolkit:RichTextBox Text="{Binding Name}" PreviewKeyDown="RichTextBox_PreviewKeyDown" />

Can you provide the code that is not working for you.

Mar 10, 2011 at 8:27 AM

Hi brian,

Thanks for your post. Yes that is exactly the same code I have...the problem (for not calling it something else ie: my st.......) was that I did not add it to the RTB I was testing, but to some other RTB! doh!