Frame Control

May 10, 2008 at 1:30 PM
Transitionals works great in an XBAP but I loose my navigation history. What I really need is a Transitionals Control based on a Frame.


Coordinator
May 14, 2008 at 12:08 AM
Have you thought about how this might be implemented? I know you can also modify the history yourself too.

rchecketts wrote:
Transitionals works great in an XBAP but I loose my navigation history. What I really need is a Transitionals Control based on a Frame.





Jul 26, 2008 at 4:14 PM
I was wondering how to do this as well. Here's what works for me: I created a custom control extending Frame and added a DependencyProperty for the transition type. Then I styled the custom control and set the ControlTemplate to use the TransitionElement and bind the Content to the Frame's Content. It seems to work for me so far but I'm still new to WPF. Here's the style:

        <Style TargetType="gt:TransitionalFrame">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="gt:TransitionalFrame">
                        <transc:TransitionElement x:Name="transitionBox" Content="{TemplateBinding Content}" Transition="{TemplateBinding Transition}" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>


And here's the markup in XAML to use the TransitionalFrame:

        <gt:TransitionalFrame Source="MainPage.xaml" NavigationUIVisibility="Hidden">
            <gt:TransitionalFrame.Transition>
                <transt:FadeTransition/>
            </gt:TransitionalFrame.Transition>
        </gt:TransitionalFrame>

Coordinator
Jul 29, 2008 at 6:07 PM
This looks really promising. Something we might want to include in the project at some point if you want to contribute it.

Don't forget about the other properties related to the TransitionElement. Things like TransitionSelector. I'd really like to come up with a slick way of defining new transition controls. I don't know if it's an ITransitionAware interface or what, but there are certainly a set of properties that are needed every time.

Thanks for sharing your thoughts on this.
Jul 29, 2008 at 11:33 PM
Yeah, this was more of a quick hack just because I was curious to see if it was possible. For instance, the style above doesn't display the navigation UI. The app I wanted to use this in was is using a frame so I didn't want to have to change everything in order to support transitions.

I'll take a stab at a more complete TransitionalFrame control keeping an eye towards a more extendable model like you mention.