Document Editor
In a WPF application, the editor of TX Text Control .NET for WPF is a control in the XAML of a window, and the toolbars, rulers, ribbon tabs and sidebars around it are controls as well. Seven tutorials build such a window step by step: first with the toolbox and a button bar, then in XAML alone, with a ribbon and sidebars, and finally with commands that open and save documents. After them, you know how the controls are declared, how they find each other by name, and where the startup code of the editor belongs.
Choose a Tutorial
| Tutorial | You build | Done in |
|---|---|---|
| Create Your First WPF Application | A .NET project with the NuGet package, the editor, a button bar, two rulers and a status bar | Toolbox, Properties window, one handler |
| Create a .NET Framework Application | The same editor in a .NET Framework 4.8 project, with a menu for files, the clipboard and formatting | Toolbox and code |
| Add TextControl in XAML | The editor declared in XAML, with properties, events and a data binding, or created in code | XAML and code |
| Connect Rulers, Toolbars, and a Status Bar | The bars connected in XAML or code, with your choice of buttons and status information | XAML and code |
| Create a WPF Ribbon Application | A RibbonWindow with the ribbon tabs of TX Text Control and a contextual Table Tools tab | XAML and code |
| Add a Sidebar | A sidebar that ribbon buttons open with styles, comments or search panels | XAML and code |
| Load and Save Documents | New, Open, Save and Save As with a prompt for unsaved changes, in a menu or the ribbon | Code |
How the Controls Work Together
Every tutorial relies on the same few rules, which the pages explain where they are first needed:
- One XAML namespace. The controls are in the namespace
TXTextControl.WPFof the assembly TXTextControl.WPF, declared once in theWindowelement with a prefix such asWPF. - Connections by name. The
TextControlfinds its button bar, rulers, status bar and ribbon tabs through string properties that hold their names, and a sidebar finds the editor the same way. - Layout by the panel. A
DockPanelplaces the bars at the sides of the window in the order of the XAML, and theTextControl, added last, fills the rest. - Startup code in Loaded. Code that works with the document runs in the
Loadedevent of theTextControl, when the editor is ready.
Where to Start
- Start with Create Your First WPF Application, or with Create a .NET Framework Application if your application runs on the .NET Framework.
- Read Add TextControl in XAML to understand the XAML the toolbox wrote.
- Decide on the user interface: a button bar, as in Connect Rulers, Toolbars, and a Status Bar, or a ribbon with sidebars, as in Create a WPF Ribbon Application and Add a Sidebar.
- Add Load and Save Documents, so that users can work with their files.
Before you start, install the setup of TX Text Control .NET for WPF on your development machine. It provides the NuGet package source, the toolbox tab and the XAML Designer support. See Installing the Product.
After These Tutorials
- Document Processing: build, convert and print documents in code.
- Mail Merge: fill templates with data.
- Document Editor: every feature of the editor in detail.
- Integration Guide: data binding, MVVM, commands and layout in WPF applications.