Skip to content

Instantly share code, notes, and snippets.

@Gabboxl
Created July 22, 2023 16:47
Show Gist options
  • Save Gabboxl/149ce6056be1eb9aec73966abb431d0c to your computer and use it in GitHub Desktop.
Save Gabboxl/149ce6056be1eb9aec73966abb431d0c to your computer and use it in GitHub Desktop.
EntranceThemeTransition code only
// Create an instance of EntranceThemeTransition
EntranceThemeTransition entranceThemeTransition = new EntranceThemeTransition();
// Set the properties of the transition
entranceThemeTransition.FromHorizontalOffset = 100; // From where the animation will start horizontally
entranceThemeTransition.FromVerticalOffset = 100; // From where the animation will start vertically
// Get the parent container of the element
var panel = myElement.Parent as Panel;
// If the parent is a Panel and doesn't already have transition set,
// then apply the EntranceThemeTransition to its ChildrenTransitions collection
if (panel != null)
{
if (panel.ChildrenTransitions == null)
{
panel.ChildrenTransitions = new TransitionCollection();
}
// Add the entranceThemeTransition to the panel's ChildrenTransitions
panel.ChildrenTransitions.Add(entranceThemeTransition);
}
// Now when you change the visibility of the element from Collapsed to Visible,
// it should animate in with the EntranceThemeTransition
myElement.Visibility = Visibility.Visible;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment