Skip to content

Other Adaptation Classes

Gary edited this page Aug 27, 2014 · 1 revision

These classes provide a variety of adaptations. Some of these types of adaptation, as in CommandServiceAdapter, are different from the adaptation of one class to another previously discussed.

Adapter class Derives from,
Implements
Description
CollectionAdapter<T, U> ICollection<U> Wrap an ICollection of one type to implement an ICollection of another type. This adapter class can be used to simulate interface covariance, where an ICollection of Type1 can be made to implement an ICollection of Type2, as long as Type1 implements or can be adapted to Type2. To observe changes to the underlying collection, consider passing in an ObservableCollection of type T.
CommandServiceAdapter ICommandService in
Sce.Atf.Applications
Present commands in menu and toolbar controls. This class adapts Sce.Atf.Wpf.Applications.ICommandService to Sce.Atf.Applications.ICommandService. This allows legacy code to run in a WPF based application. For more information, see Using WinForms Commands in WPF.
ControlHostService-
Adapter
IControlHostService in
Sce.Atf.Applications
Provide control host services. Class to adapt Sce.Atf.Wpf.Applications.IControlHostService to Sce.Atf.Applications.IControlHostService. This allows WinForms-based applications to run in a WPF based application. For more information, see Using WinForms Commands in WPF.
CustomTypeDescriptor-
NodeAdapter
DomNodeAdapter
ICustomTypeDescriptor
Node adapter to get PropertyDescriptors from a DomNodeType and other metadata. This is very useful for metadata-driven property editing in property editors. For more details, see AdapterCreator Class.
DomNodeListAdapter<T> IList<T> Wrapper that adapts a node child list to a list of T items. The adapted list item type T adapts a DomNode or is a DomNode and should implement IAdaptable. Examples include DomNodeAdapter, DomNode, and IAdapter. For more information on this class, see the ATF Programmer’s Guide: Document Object Model (DOM), which you can download at ATF Documentation.
ListAdapter<T, U> CollectionAdapter<T, U>
IList<U>
Wrap an IList of one type to implement an IList of another type. This adapter class can be used to simulate interface covariance, where an IList of Type1 can be made to implement an IList of Type2, as long as Type1 implements or can be adapted to Type2.
ListViewAdapter Adapter that adapts a System.Windows.Forms.ListView control to an IListView. For more information, see ListViewAdapter Class in File Explorer Programming Discussion.
MainFormAdapter IMainWindow Class to adapt a System.Windows.Forms.Form to IMainWindow. This class can be used as a lightweight adapter for components that need to support both System.Windows.Forms.Form and IMainWindow for backwards compatibility.
MainWindowAdapter IMainWindow, IInitializable Component to manage lifetime and notifications for the main window. For an example of its use, see Using WinForms Controls in WPF.
RetrieveVirtual-
NodeAdapter
EventArgs Wrapper around ListView's RetrieveVirtualItem to allow client code to supply adapted user data. This is used when the underlying TreeListView's style is set to VirtualList and the underlying ListView is requesting an item that it doesn't know about. It makes a data query of the TreeListView, which then queries the TreeListViewAdapter for the data.
StatusServiceAdapter IStatusService in
Sce.Atf.Applications
Component that manages a status display. Class to adapt Sce.Atf.Wpf.Applications.IStatusService to Sce.Atf.Applications.IStatusService. This allows WinForms-based applications to be run in a WPF based application.
TreeControlAdapter Class to adapt a TreeControl to a data context that implements ITreeView. For more information, see TreeControlAdapter Class in File Explorer Programming Discussion. The following optional interfaces may also be used by a context:
# IItemView is used to determine the item's label, icon, small icon, whether it's checked, and so on.
# IObservableContext is used to keep the TreeControl nodes in sync with the data.
# IValidationContext is used to defer updates until the data becomes stable. This allows more efficient updates of the TreeControl and saves IObservableContext implementations the trouble of calculating indices for ItemInserted and ItemRemoved events. These may be set to -1 in this case, and the TreeControl can still update itself correctly.
TreeListViewAdapter Wrap a TreeListView and allow a user to supply data to the TreeListView through the ITreeListView interface and the View property of the TreeListViewAdapter. The ATF Tree List Editor Sample uses TreeListViewAdapter.

Topics in this section

Clone this wiki locally