Allow user to use tab in RichEditBox in a Windows 8 App?

别说谁变了你拦得住时间么 提交于 2019-12-23 12:25:00

问题


Right now the tab function moves the focus to the next control, I want it so it just actually tab in the Text Box.

I noticed you cannot tab in the Windows 8 Mail app also....

Also is there a RichTextBox alternative?


回答1:


Currently (in the RTM release) there is no AcceptsTab like setting for RichEditBox (it only has AcceptsReturn) see also this feature suggestion.

However you can subscribe on the KeyDown event of your RichEditBox where you can handle the tab key yourself:

private void RichEditBox_KeyDown(object sender, KeyEventArgs e)
{
    if (e.Key == VirtualKey.Tab)
    {
        RichEditBox richEditBox = sender as RichEditBox;
        if (richEditBox  != null)
        {
            richEditBox.Document.Selection.TypeText("\t");
            e.Handled = true;
        }
    }
}


来源:https://stackoverflow.com/questions/12654213/allow-user-to-use-tab-in-richeditbox-in-a-windows-8-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!