Can the content know when a transition is starting and ending?

6 posts, 0 answers
  1. Paul
    Paul avatar
    38 posts
    Member since:
    Feb 2014

    Posted 13 Feb 2014 Link to this post

    I have some content that will contain a browser window.  The browser window I am using does not work well with WPF transitions, etc. (i.e. air space issues).  So I need to Hide/Collapse the Browser portion of the content while any animations on its containing control are occurring. And I then would make the Browser window visible when the transition is complete.  Usually the content in a RADTransitionControl should not care, but there are times like above when it does.  Its ugly, but it is much better looking than the alternative.

    Before obtaining the Telerik controls I had used the Transition Control from the WPF Toolkit.  I modified it to check and see if the content it was transitioning implemented an interface I created called ITransitioningAware.  If it did, it would call starting and completed methods on that interface to let the content know what is going on.  Has Telerik implemented anything similar to let the content be aware of the transitioning process?  If not, can it get onto the wish list?  I know its a special case, but that's what a lot of these kinds of features end up being for.

    I could potentially implement the functionality in the parent of the TransitionControl by handling the Events it generates but I need to be aware of previous and next content to do it.  Are those available at the time of the events?

    Thanks
    Paul
  2. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 18 Feb 2014 Link to this post

    Hello,

    In order to be notified when the animation has been triggered and completed you could use the TransitionStatusChanged event of the control. In that event you can use the TransitionStatusChangedEventArgs to get if the transition has Started or Completed. The next code snippet shows the described approach:
    <telerik:RadTransitionControl TransitionStatusChanged="TransitionControl_TransitionStatusChanged" />

    and in the event handler:
    private void TransitionControl_TransitionStatusChanged(object sender, Telerik.Windows.Controls.TransitionControl.TransitionStatusChangedEventArgs e)
    {
        if (e.Status == Telerik.Windows.Controls.TransitionControl.TransitionStatus.Started)
        {
            // Transition has Started
        }
        else if (e.Status == Telerik.Windows.Controls.TransitionControl.TransitionStatus.Completed)
        {
            // Transition has Completed
        }
        else
        {
            // Transition has been Interrupted
        }
    }

    Hope this is helpful.

    Regards,
    Vladi
    Telerik
  3. UI for WPF is Visual Studio 2017 Ready
  4. Paul
    Paul avatar
    38 posts
    Member since:
    Feb 2014

    Posted 18 Feb 2014 in reply to Vladi Link to this post

    Thanks for the reply.

    In order to know about the TransitionStatusChanged Event, one would have to hook the event on the TransitionControl.  Content usually is not aware of the container/content control it is in.  I have to get the "Animating Started" and "Animating Ended" actions to the Content, both the one that is transitioning out, and the one that is transitioning in.  I can do this if the control/window that has hooked the TransitionStatusChanged Event can get at the previous and next content.  Is that possible through the TransitionControl?   I don't see it in the StatusChangedEventArgs.   I use as much MVVM as I can, so usually the content is an object/ViewModel that has a datatemplate for the visuals. 

    Thanks again.
    Paul
  5. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 21 Feb 2014 Link to this post

    Hi,

    The RadTransitionControl is a ContentControl which has only one content (rather than a collection of contents) and it adds a transition animation when that content is changed. When that content is changed the control is not aware from what and to what content it is transitioning which is why it does not provide notification to it's content for the animation start and end. In order to achieve such behavior a custom implementation should be added. We are not aware of an appropriate approach that could be used to achieve such behavior.

    Regards,
    Vladi
    Telerik
  6. Paul
    Paul avatar
    38 posts
    Member since:
    Feb 2014

    Posted 21 Feb 2014 in reply to Vladi Link to this post

    Thank you for the reply.

    I agree that the Transition Control is a Content Control.  But I disagree that it doesn't have to know about the "from" and "To" content.  It has to animate them.  If you look at the source for your TransitionPresenter it knows all about the Current content and the New Content.  It creates Visual Brushes of each and then transitions the brushes as needed.  It knows start and end of the transition. 

    I realize that the control does not do this now, I was just hoping that y'all could include the functionality in a future release, or surface events that would allow a user to implement the use case.  It appears that the Transition Presenter knows about 5 states. 


    private enum TransitionStates
    {
    Idle,
    Prepared,
    Playing,
    Complete,
    Interrupted
    }

    If those could be surfaced in events, or if the TransitionPresenter could check to see if the content implemented a known interface and then let the content know those states, it would be nice.  If not, so be it.  But figured I would ask.  The use case I presented in the first msg is an edge condition, but is one that is encountered quite often when having to deal with Air Space issues in WPF and still make things look good.

    Thanks again
    Paul
  7. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 21 Feb 2014 Link to this post

    Hello,

    Thank you for the constructive feedback.

    We are always trying to improve the functionality of our controls and we will discus the presented use case in order to fully understand what could be improved in the concept of the RadTransitionControl.

    You can use our feedback portal to add any feature requests, bug reports or general feedback for Telerik UI for WPF and Silverlight.

    Regards,
    Vladi
    Telerik
Back to Top
UI for WPF is Visual Studio 2017 Ready