Using WPFCAB for CCF

AIF is built on the Pattern & Practices Composite UI Application Block (CAB). AIF uses the CAB utilities and services for messaging, visual containment, application loading, state management, and so on. You can use the WPF layer of the CAB utility to develop CCF applications in a pure WPF environment. For more information about WPFCAB, see the respective site on CodePlex. However, to use the WPFCAB with CCF you must edit the CompositeUI solution in the WPFCAB source code.

You can use the WPFCAB and the CCF Shell Framework to create a WPF CCF shell, which is a CCF shell supporting WPF capabilities. You can use the WPF CCF Shell to host new applications in the CCF environment.

Dynamic positioning method of hosting external and web applications in CCF uses Win32 API and the traditional Windows painting/drawing system to position the hosted applications so that, user experience is seamless like the parenting technique. Dynamic positioning technique also monitors for native window events (such as window dragging, activation, deactivation and so on) in the parent window, and positions the hosted applications appropriately. Since Windows Presentation Foundation uses an entirely new rendering technique (DirectX based and leveraging GPU) , which is different from the native windows drawing/painting  technique. Dynamic positioning, which extensively uses Win32 API, should be given a second preference as a method to hosting applications in WPF shell. It is recommended that you use the existing CCF shell (WinForm Shell) while hosting existing applications or while using Dynamic Positioning. For more information about Dynamic Positioning, see the CCF 2009 SP1 Deployment Guide. For more information about the CCF Shell Framework, see CCF UI Shell Framework.

To edit the CompositeUI Solution for CCF:

  1. Download the WPFCAB Source Code from CodePlex.

  2. Extract the contents of the compressed file to a folder (For example, C:\WPFCAB Source\).

  3. Open the CompositeUI solution file from the WPFCAB source code folder.

  4. Expand the CompositeUI.Windows project.

  5. In the References folder of the project, remove the references for CompositeUI and ObjectBuilder.

  6. Right-click on the References folder, and add select Add Reference.

  7. Select the Browse tab, and select the files Microsoft.Ccf.Practices.CompositeUI.dll and Microsoft.Ccf.Practices.CompositeUI.WinForms.dll from the folder <InstallDir>/Framework.

  8. From the WorkSpaces folder of the project, open the ZoneWorkspace.cs file.

  9. Comment the following method:

  10. void IComposableWorkspace<FrameworkElement, ZoneSmartPartInfo>.RaiseSmartPartActivating(WorkspaceCancelEventArgs e)
    {
    OnSmartPartActivating(e);
    }
    
  11. Change the return types of the following methods from bool to void:

  12. Method

    Edited Method

    public bool Activate(object smartPart)

    {

    return _composer.Activate(smartPart);

    }

    public void Activate(object smartPart)

    {

    _composer.Activate(smartPart);

    }

    public bool Show(object smartPart, ISmartPartInfo smartPartInfo)

    {

    return _composer.Show(smartPart, smartPartInfo);

    }

    public void Show(object smartPart, ISmartPartInfo smartPartInfo)

    {

    _composer.Show(smartPart, smartPartInfo);

    }

    public bool Show(object smartPart)

    {

    return _composer.Show(smartPart);

    }

    public void Show(object smartPart)

    {

    _composer.Show(smartPart);

    }

  13. Repeat the above step for the files “DeckWorkspace.cs” and “TabWorkspace.cs”.

  14. Compile the CompositeUI solution. The build process creates a DLL file Microsoft.Practices.CompositeUI.Windows.dll in the build output folder.

  15. Copy the DLL file to the IAD project folder that uses WPF.

  16. Compile the IAD project.