This is a migrated thread and some comments may be shown as answers.

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

5 Answers 77 Views
TransitionControl
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 13 Feb 2014, 01:09 PM
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

5 Answers, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 18 Feb 2014, 08:49 AM
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
0
Paul
Top achievements
Rank 1
answered on 18 Feb 2014, 12:08 PM
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
0
Vladi
Telerik team
answered on 21 Feb 2014, 08:56 AM
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
0
Paul
Top achievements
Rank 1
answered on 21 Feb 2014, 12:31 PM
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
0
Vladi
Telerik team
answered on 21 Feb 2014, 01:53 PM
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
Tags
TransitionControl
Asked by
Paul
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Paul
Top achievements
Rank 1
Share this question
or