Convert comment to response: as far as I know, the FrameworkElement.Loaded event will fire every time you scroll through the list. For example - ListBox . I tried applying animation to load a new item in the ListBox , but the event was fired each time I scroll. Everything was so because:
But the default value of ScrollViewer.CanContentScroll set to true , which means that when you scroll through each item, a new one is created. This is done to improve the loading of large lists with a large number of items. If it is set to false , then after all the elements are loaded into memory, which may affect performance if there are many elements. And the FrameworkElement.Loaded event will fire only once (at least this should be a test for a small ListBox ).
Quote from a good source about CanContentScroll :
ScrollViewer currently allows you to use two scrolling modes: smooth scrolling by pixels (CanContentScroll = false) or separate scrolling by points (CanContentScroll = true). Currently, WPF only supports user interface virtualization when scrolling through an item. Pixel scrolling is also called “physical scrolling,” and item-based scrolling is also called “logical scrolling.”
Even in the case of the Visibility property, that is:
Visibility.Collapsed -> Visibility.Visible
The FrameworkElement.Loaded event is raised only after the first conversion visibility. If you later change the visibility property, the event will not fire.
I think this event It should be used for static controls that are displayed only once, for example, when the program starts.
source share