The One With

WinForms Transition Manager (New in v14.1)

Among many new controls and features in v14.1, we have also introduced a new non visual component, a Transition Manager. A Transition Manager takes care of animations when switching from one UI view to the next. What's cool is that not only views could be animated, but also anything that changes a visual state.

For instance, suppose we want to change the background of a container:

To animate this change, simply wrap the code you had before inside a transaction, like so:

private void colorPickEdit_EditValueChanged(object sender, EventArgs e) {
    if (transitionManager1.IsTransaction) {
        transitionManager1.EndTransition();
    }

    transitionManager1.StartTransition(containerPanel);
    try {

        containerPanel.BackColor = colorPickEdit.Color;

    } finally {
        transitionManager1.EndTransition();
    }
}

Similarly, if for instance we want to navigate from a view of Customers to a view of Employees:

T Find<T>(Control container) where T : Control {
    for (int i = 0; i < container.Controls.Count; i++) {
        if (container.Controls[i] is T) {
            return (T)container.Controls[i];
        }
    }
    return null;
}

void ChangeView<T>() where T : Control, new()  {
    if (transitionManager1.IsTransaction) {
        transitionManager1.EndTransition();
    }
            
    transitionManager1.StartTransition(containerPanel);
    try {
                
        T find = Find<T>(containerPanel);
        if (find != null) {
            find.BringToFront();
        } else {
            find = new T();
            find.Parent = containerPanel;
            find.Dock = DockStyle.Fill;
            find.BringToFront();
        }

    } finally {
        transitionManager1.EndTransition();
    }
}


To try this for yourself: Download Sample


Cheers,

Azret




Published Jun 10 2014, 12:17 PM by
Bookmark and Share

Comments

Del W

Nice!

June 11, 2014 7:34 AM

Miguel yskatll

Genial!

June 11, 2014 3:56 PM
LIVE CHAT

Chat is one of the many ways you can contact members of the DevExpress Team.
We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.

If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

FOLLOW US

DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

Copyright © 1998-2016 Developer Express Inc.
All trademarks or registered trademarks are property of their respective owners