views:

744

answers:

1

I'm writing a WPF application with a RichTextBox and a Toolbar (a VERY simple RichText Editor). Anyway, I want to put 6 unicode characters in the ToolBar that can be clicked and will be inserted at whatever point to the RichTextBox.

This seems like something that should be fairly simple to do (without a lot of codebehind). Is it, or do I have to write some custom methods to make this happen?

Thanks,

Kyle

+2  A: 

An event handler in the codebehind seems like the natural way to go, to me. Unicode characters are simply characters in .NET, so the fact that they may be outside the ASCII character set does not imply any additional difficulty.

Something like this ought to do:

private void button_Click(object sender, RoutedEventArgs e)
{
    MyRtb.CaretPosition.InsertTextInRun("む");
}
PeterAllenWebb