Skip to content

ATF Simple DOM Editor WPF Sample

Gary edited this page Mar 17, 2015 · 4 revisions

Table of Contents

Description

SimpleDomEditorWpf is very similar to the SimpleDomEditor sample, but it is implemented using ATF’s WPF framework. It demonstrates the use of the DOM (Document Object Model) with data containing a sequence of Events, which can contain Resources. Each Event sequence file displays in a WPF ListView control, which shows all Events and Resources that can be selected and edited, as well as the properties on the selected items to be edited. The Resources editor tracks the last selected Event and displays its Resources in another ListView control.

SimpleDomEditorWpf shows how to implement IDocumentClient and use the document framework to manage multiple documents, and how to implement File menu items. It shows how to implement a UI parts palette and how to display editable lists of Events and Resources, how to adapt data to a list, and how to use ContextRegistry to track the active editing context. It also demonstrates how to adapt data so that ATF command components can be used to get undo/redo and cut/paste commands, how to enable property editing on selected UI elements, and how to implement a standard Help/About dialog.

For information about programming in this sample, see Simple DOM Editor WPF Programming Discussion.

ATF Features Demonstrated by SimpleDomEditorWpf

  • Define a data model using an EventSequence.xsd XML schema. XML is also used for application data.
  • Use of DomGen to autogenerate DOM metadata for use by adapters.
  • Use of adapters to decorate the DOM to create Event sequence data models.
  • Use of IDocumentClient and the document framework to manage multiple documents.
  • Show implementing IPaletteClient to create a UI parts palette.
  • Use of ContextRegistry to track the active editing context, so application components always apply where the user is editing.
  • Use of the interfaces IInstancingContext and ISelectionContext to adapt data for editing commands.
  • Use of the WPF ATF PropertyEditor component to allow property editing on selected UI elements.

Run SimpleDomEditorWpf

  1. Double-click the SimpleDomEditorWpf.exe in \bin\wws_atf\Release.
  2. The SimpleDomEditorWpf window appears.
  3. You can create or open a file using toolbar buttons or the File menu item.

SimpleDomEditorWpf has the following windows:

  • Palette (Events and Resources): choose Event, Animation, or Geometry.
  • Event sequence file: the current Event sequence file being edited. Multiple documents are supported.
  • Property Grid: edit a selected Event or Resource property in a list control.
  • Resources: list the Resources for the currently selected Event in the active Event sequence file.
The toolbar and menu bar contain standard buttons for file management: save, create new, open existing, and so on, and editing: cut, copy, paste, delete, undo/redo. The Edit menu also provides the standard editing functions as well as keyboard shortcuts, load or save settings, and preferences. Use the Window menu item to hide and display windows. Help provides information about SimpleDomEditorWpf.

How to Use SimpleDomEditorWpf

To start:

  1. Create an Event sequence file. Select File > New Event Sequence in the SimpleDomEditorWpf menu. A Save As window appears. Choose location and new file name for your Event sequence file, then click OK. An empty sequence file opens in the editing canvas.
  2. From the Palette, drag and drop an Event onto the Event sequence file in the editing canvas.
  3. Select an Event to view and edit Event properties.
To add Resources:
  1. Select an Event.
  2. Drag and drop Resources (Animation or Geometry) onto the Resource pane.
  3. Select a Resource to view and edit Resource properties.

SimpleDomEditorWpf Modules

Modules perform these functions:

  • App.xaml.cs: Contains the partial class App. It creates a TypeCatalog listing the ATF and internal MEF components used.
  • EventSequenceView.xaml: Defines the EventSequenceView control displaying Event sequences.
  • ResourceListView.xaml: Defines the ResourceListView control displaying Resources.
  • Editor.cs: Implements IDocumentClient and uses the document framework to implement File menu commands.
  • PaletteClient.cs: Implements IPaletteClient and uses IPaletteService to create a UI parts palette.
  • ResourceListEditor.cs: Display Resources that belong to the most recently selected Event.
  • EventSequenceContext.cs: Implement the ATF interfaces IInstancingContext and ISelectionContext to adapt Event data so that ATF command components can be used to get undo/redo, cut/paste, and selection commands in the EventSequenceView.
  • ResourceListContext.cs: Implement the ATF interfaces IInstancingContext and ISelectionContext to adapt Resource data so that ATF command components can be used to get undo/redo, cut/paste, and selection commands in the ResourceListView.
  • EventSequenceDocument.cs: Extend DomDocument, which implements IDocument.

Topics in this section

Clone this wiki locally