I'm developing a Windows WPF app that needs to edit a certain type of document and I need a highly customized editor to do so:

enter image description here

The text is a transcription of an audio feed, and I need to sync the the text with a time code of the corresponding word in the audio stream (red numbers on left). This may involve breaking text not at a carriage return (not actually present in my text), but based on a custom timing algorithm (as shown).

I also want custom cursor logic, for instance, having CTRL + -> jumping ahead 10 seconds at a time (however many letters that may be). I will also need to format individual words and phrases in various ways.

My question is: do I build from scratch or enhance an existing text editor (TextBox, RichTextBox, FlowDocument, etc.)?

If I use an existing control, I will get powerful features built in, but may run into design limitations--such as default line breaking--that will make it difficult to implement my requirements, or at least I may have to fight the default implementation.

If I roll my own low level control, I have total control but I have to implement everything myself.

How shall I make this decision?

  • Line wrapping/breaking behavior is usually a configurable behavior, even for existing text editors because different people have different preferences regarding line wrapping/breaking. It's not uncommon to configure text editors to wrap/break differently for different file types or different projects, so at least in this particular aspect you should be fine. – Lie Ryan Apr 23 '18 at 12:38
  • @LieRyan: this wouldn't be something configurable like break when matching some pattern. Every line would break at a programmatically determined spot, so I'm not sure this would quite apply. – Joshua Frank Apr 23 '18 at 13:22
  • 2
    How long would it take to knock up a simple prototype using your existing control, so that you could find out if any "design limitations" exist? – Robert Harvey Apr 23 '18 at 16:54
  • 1
    @JohnR.Strohm: I am pretty sure GNU Emacs won't integrate well as a control into a WPF application. – Doc Brown Apr 24 '18 at 5:47
  • 1
    It seems you don't need a control with line breaking, quite the opposite. You need a control to hold the text of one line with individual formatting of words, which you can put into a table. A TextBox is not well suited because AFAIK it does not support the latter. A RichTextBox supports that, but you will need to fiddle around with the PageWidth to prevent line breaking, suppressing line breaks this is not well supported. – Doc Brown Apr 24 '18 at 6:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.