WinRT XAML custom Transition
Asked Answered
P

2

9

Is it possible to implement a custom Transition in WinRT? E.g. it would be nice to have transitions for the control visibility. So when you show/hide a part of a split view it animates the entire view by using a sliding effect.

Pharsalus answered 30/11, 2012 at 19:24 Comment(0)
T
0

Yes you can, using the usual WPF animation techniques, only with minor changes to WinRT.

The usual pattern is to apply double/color/easing animations to your UI elements via storyboarding - being triggered by changes in the visual state manager. You can do this either declaratively or via code-behind.

http://www.codeproject.com/Articles/23257/Beginner-s-WPF-Animation-Tutorial

http://blogs.msdn.com/b/wpfsdk/archive/2009/02/27/the-visualstatemanager-and-triggers.aspx

Tarriance answered 3/12, 2012 at 7:56 Comment(1)
I'm asking specifically about transitions but not animations or triggers.Pharsalus
C
0

As far as I know you can't build your custom transitions and use them like normal WinRT Transitions, that is, inside a TransitionCollection.

<ListView.Transitions>
    <TransitionCollection>
        <myTransitions:PotatoeTransition/>
    </TransitionCollection>
</ListView.Transitions>

You can't do the above as far as I know. (ignore the fact that I exemplified with a ListView, it applies to everything, I think)

You'll probably have to use a Storyboard that animates both the RenderTransform (TranslateTransform) and the Opacity to achieve your objective.
I think you can still create a Behavior though if you want to make it more reusable.

Carley answered 7/4, 2015 at 10:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.