-
Notifications
You must be signed in to change notification settings - Fork 260
Using WinForms Controls in WPF
You can use WinForms-based component controls and dialogs in a WPF based application. This is made possible by the ControlHostServiceAdapter component, which implements the WinForms IControlHostService so that it works in a WPF environment. In other words, it adapts Sce.Atf.Wpf.Applications.IControlHostService to Sce.Atf.Applications.IControlHostService.
The ControlHostServiceAdapter component exports Sce.Atf.Applications.IControlHostService. If this component is included in an application, the WinForms-based components that need IControlHostService import it from ControlHostServiceAdapter, rather than the WinForms-based ControlHostService component. This allows the components to function with the WPF application. In this case, the application would not include the WinForms-based ControlHostService component — or any other component implementing the WinForms IControlHostService — in its MEF catalog.
ControlHostServiceAdapter also creates an object of the ControlHostClientAdapter class, which adapts to WPF the IControlHostClient interface for WinForms-based control clients. This allows these control clients implementing Sce.Atf.Applications.IControlHostClient to operate properly in WPF.
The StandardInteropParts class includes the ControlHostServiceAdapter component in a MEF TypeCatalog:
public class StandardInteropParts
{
/// <summary>
/// Gets type catalog for all components</summary>
public static ComposablePartCatalog Catalog
{
get
{
return new TypeCatalog(
typeof(MainWindowAdapter),
typeof(ContextMenuService),
typeof(DialogService),
typeof(ControlHostServiceAdapter)
);
}
}
}This catalog can be included in an AggregateCatalog, as in this line from the ATF Simple DOM Editor WPF Sample:
return new AggregateCatalog(typeCatalog, StandardInteropParts.Catalog, StandardViewModels.Catalog);After this, the WPF application can use the WinForms-based component controls — with no additional support from the application.
- Using Controls in ATF: Overview of using controls in ATF.
-
ControlInfo and ControlDef Classes: Description of the
ControlInfo(WinForms) andControlDef(WPF) classes that describe a control's appearance and location in the UI. - ATF Control Groups: About control groups, which provide an initial position for a top-level control.
-
Registering Controls: How to register controls with the
ControlHostServicecomponent. - Creating Control Clients: Creating a control client that specifies the control's behavior, if any, when the control gains or loses focus, or is closed.
- Using WinForms Controls in WPF: How to use WinForms-based component controls and dialogs in a WPF based application.
-
Adaptable Controls: Discussion of the
AdaptableControlclass, which provides a control with adapters. - ATF Custom Controls: Overview of the custom controls ATF provides.
- ATF Custom Dialogs: Overview of the standard dialogs in ATF.
- Home
- Getting Started
- Features & Benefits
- Requirements & Dependencies
- Gallery
- Technology & Samples
- Adoption
- News
- Release Notes
- ATF Community
- Searching Documentation
- Using Documentation
- Videos
- Tutorials
- How To
- Programmer's Guide
- Reference
- Code Samples
- Documentation Files
© 2014-2015, Sony Computer Entertainment America LLC