This project has moved. For the latest updates, please go here.

UIElementActivation

Overview

The Composite UI Application Block contains strategies and a service to control the WorkItem status. Especially interesting is the active and inactive status of a WorkItem. This status can be used to trigger further functionalities which are connected to the WorkItem. By example in the Test Suite reference application the LogViewer.Demo module shows a dynamic help page if the WorkItem gets activated.

This activation functionality uses the Enter and Disposed events of Windows Forms controls to trigger the WorkItem which contains the control. However CAB does not provide this functionality for WPF controls. Thus the CAB Extension library fill this gap with the following classes:
  • WPFFormServiceStrategy: A BuilderStrategy that adds an instance of the UIElementActivation service into every WorkItem.
  • IUIElementActivationService: Defines a service to deal with the WorkItem activation and deactivation based on its contained UIElement status.
  • UIElementActivationService: The default implementation of the IUIElementActivationService interface. It activates the WorkItem if the UIElement got the focus.
  • UIElementActivationStrategy: A BuilderStrategy that hooks up an UIElement with the IUIElementActivationService.
The main difference between this implementation and the implementation of CAB is that these classes use the GotFocus event of WPF UIElements. Both implementations needs to be instantiated and configured in a CAB application with WPF support.

How to use the UIElementActivation?

The recommended way to use the UIElementActivation service is by extending from the SplashWPFFormShellApplication class like the Test Suite reference application does. If this is not an option the following lines of code needs to be added to the ShellApplication class:

protected override void AddBuilderStrategies(Builder builder)
{
    ...
    builder.Strategies.AddNew<WPFFormServiceStrategy>(BuilderStage.Initialization);
    builder.Strategies.AddNew<UIElementActivationStrategy>(BuilderStage.Initialization);
}

protected override void AddServices()
{
    ...
    RootWorkItem.Services.AddNew<UIElementActivationService, IUIElementActivationService>();
}

Last edited Oct 8, 2007 at 1:36 PM by jbe2277, version 6

Comments

No comments yet.