Context Editor in WPF

Currently, we want to create a text editor in WPF (.NET 4.0) that will allow writers in our team to create movie scripts. In short, the functionality must match the FinalDraft or Adobe Story model (i.e.: contextual positioning of the text depending on the position of the cursor and the user's intentions)

We are currently looking at two different solutions:

  • One WPF control that will act as a container, and several small text editing controls that will represent the lines in the script. This will allow us to position the controls using their field, as well as simplify the snapping. The challenge here was to handle multi-line elections. I was thinking about using Listbox as a container, and each list item would be a custom control containing a text box. This will require the creation of controls based on the user's actions. Everything will be tailored to create the impression that the user is working on a blank page.

  • One large text field capable of displaying custom XML data. The task here was to determine exactly where the cursor is located (i.e.: the cursor is located above the name of the actor, etc.) and position the text accordingly (i.e.: the names of the actors are centered in the caps, etc. )

I recently tried to implement the first solution, but to re-implement the whole selection behavior built into the base text fields is nontrivial and requires a lot of work. As for the second solution, binding to my business objects will be much more complicated than just creating multiple controls with different bindings.

Do you have any other solution?

+6
source share
1 answer

I needed a text editor for the application once. We had a large xml file for the settings, and the user should be able to edit them.

It turns out that if your file is large enough (+ 10,000 lines), then the rich text field becomes quite slow.

How to create a gui mask: only if your user uses some short options, such as text. But I understand that you want your users to write creative text. This “gui mask” - “many small places” will make them feel in the 80s.

I suggest: do not write the Program, just write the plugin in the output editor. Some of them are free: http://www.codeproject.com/Articles/42490/Using-AvalonEdit-WPF-Text-Editor or add to the word - people love the Word and know the Word http://www.codeproject.com/Articles / 8837 / Writing-a-Word-Add-in-Part-I

And for data binding, etc.: After writing the text, the user just needs to click the save button, and you can analyze the input for information. I would not do it on the fly, as it can become quite slow. You also say that the information is connected in such a way that only if all the data is recorded, you can use it.

+1
source

Source: https://habr.com/ru/post/920049/


All Articles