Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to re-enable the EntranceThemeTransition in C# code?

Tags:

c#

windows-8

xaml

from this link. I can animate my Grid with this code inside the Grid in XAML:

<Grid.Transitions>
    <TransitionCollection>
        <EntranceThemeTransition />
    </TransitionCollection>
</Grid.Transitions>

it simply animate the grid when we start the page. But can we animate it again in C# so when users click a button it will animate again?

like image 352
Hendra Anggrian Avatar asked Dec 05 '25 16:12

Hendra Anggrian


1 Answers

if you are trying to reanimate the transition, i can suggest that you can remove the grid and then create again the grid:

XAML

<Grid x:Name="grid"></Grid>

then in code you can do this

grid.Children.Clear();

then recreate it again afterwards

grid.Children.Add("//insertItemsHere");

after a button was click for example, it will delete all the items in grid and it will add again the controls by this it will do animation again.

Here an example code:

public void btn_click(object sender, RoutedEventsArgs e)
{
    Grid.Children.Clear();
    Grid.Children.Add(ListView);



}
like image 123
Paul Avatar answered Dec 07 '25 07:12

Paul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!