Created
July 22, 2023 16:47
-
-
Save Gabboxl/149ce6056be1eb9aec73966abb431d0c to your computer and use it in GitHub Desktop.
EntranceThemeTransition code only
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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