This demo demonstrates how to host WPF Composite Control packaged into a .Net library in Delphi using the .Net Runtime Library for Delphi TClrContainer component.
The walkthrough is divided into two sections. The first section briefly describes the implementation of the WPF composite control in C#. The second section discusses in brief how to host the composite control in a Delphi VCL Forms application, receive events from the control, and access some of the control’s properties. The demo contains a working example of how the WPF control in MyControl.dll is hosted in a Delphi VCL Forms using the TClrContainer component which is dropped unto the Delphi VCL Form.
Tasks illustrated in this walkthrough include:
- Implementing the WPF composite control.
- Implementing the Delphi VCL Forms host application.
Prerequisites:
You need the following components to complete this walkthrough:
Implementing the WPF composite control.
Assuming you have created WPF composite control and packaged in a DLL. See example in demo: MyControls.dll is the WPF composite control compiled into .Net Library
Implementing the Delphi VCL Forms host application
The Delphi VCL Forms host application uses an TClrContainer together with TElementHost object in WindowsFormsIntegration unit to host the WPF composite control in the dll. The application handles the OnButtonClick event to receive the data from the composite control.The application also has a set of option buttons that you can use to modify the control’s appearance.