The following example code uses IsLoaded as a conditional check to assure that a function displayData (not shown) will have valid elements loaded on the page to work against, as part of an on-demand handler. That same logic is run as an event handler for Loaded.
PrivateSub OnLoad(ByVal sender AsObject, ByVal e As RoutedEventArgs)
EndSubPrivateSub updateSummary(ByVal sender AsObject, ByVal e As RoutedEventArgs)
If myflowdocument.IsLoaded Then