Repeat EntranceThemeTransition
Asked Answered
G

1

9

I have a simple TabControl done using templated RadioButtons and Grids which change visibility when IsChecked on a RadioButton changes, something like this:

<Grid Name="TabGrid">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Orientation="Horizontal">
            <RadioButton x:Name="RadioButton1" Content="Latest" Style="{StaticResource TabRadioButtonStyle}" IsChecked="True" GroupName="G1"/>
            <RadioButton x:Name="RadioButton2" Content="Popular" Style="{StaticResource TabRadioButtonStyle}" IsChecked="False" GroupName="G1" Margin="30,0,0,0" />
        </StackPanel> 

Now, every grid inside has EntranceThemeTransition defined, something like this:

        <GridGrid.Row="1" Visibility="{Binding ElementName=RadioButton1, Path=IsChecked, Converter={StaticResource BoolToVisibilityConverter}}">
            <Grid.ChildrenTransitions>
                <TransitionCollection>
                    <EntranceThemeTransition />
                </TransitionCollection>
            </Grid.ChildrenTransitions>

As I understand, the EntranceThemeTransition displays only when the items are first shown. Is there a way to force EntranceThemeTransition to repeat every time the visibility of the Grid changes?

Gastroenterostomy answered 26/1, 2013 at 22:57 Comment(0)
M
0

This doesn't exactly answer your questions but I think will help many people landing on here:

If you want to repeat the entrance animations for items in a databound listbox, I have found only one way of doing this:

  • Set the DataContext of the listbox to null (this removes the items).
  • Set the DataContext of the listbox back to your list/observable collection (this recreates the items and adds them to the listbox with an animation).

By reseting the DataContext you are creating new listbox items and they aren't marked as having entered the view yet.

In regards to your question; I think you'll need to create a new version of the grid to play the entrance animation again.

Mariel answered 24/9, 2015 at 12:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.