How to: Access the Transition Manager
- 2 minutes to read
This topic demonstrates how to access the Transition Manager used to animate the transition on OfficeNavigationBar root groups switching when the OutlookStyleMainRibbonForm Template is used in a WinForms application.
Perform the following steps to access the TransitionManager object and customize its settings.
- Create a new WindowController in your WinForms module.
- Override the Controller’s OnActivated method, get the OfficeNavBarTransitionController using the Frame.GetController<ControllerType> method and subscribe to the OfficeNavBarTransitionController.CustomizeTransition event.
- To access the TransitionManager object in the CustomizeTransition event handler, use the e.TransitionManager parameter.
- Unsubscribe from the CustomizeTransition event in the overridden OnDeactivated method when the Controller is deactivated.
- In the CustomizeTransition event handler, assign the Transitions.TransitionType property to the newly created object of the CombTransition type.
using DevExpress.ExpressApp.Win.SystemModule;
using DevExpress.Utils.Animation;
//...
public class TransitionCustomizationController : WindowController
{
private OfficeNavBarTransitionController officeNavBarTransitionController;
private void OnCustomizeTransition(object sender, CustomizeTransitionEventArgs e) {
e.TransitionManager.Transitions[e.TransitionControl].TransitionType = new CombTransition();
}
protected override void OnActivated() {
base.OnActivated();
OfficeNavBarTransitionController officeNavBarTransitionController = Frame.GetController<OfficeNavBarTransitionController>();
if(officeNavBarTransitionController != null) {
officeNavBarTransitionController.CustomizeTransition += OnCustomizeTransition;
}
}
protected override void OnDeactivated() {
if(officeNavBarTransitionController != null) {
officeNavBarTransitionController.CustomizeTransition -= OnCustomizeTransition;
}
base.OnDeactivated();
}
public TransitionCustomizationController() {
TargetWindowType = WindowType.Main;
}
}
Run the application to ensure that the transition type was changed.