FrameworkElement.IsLoaded Proprietà
Definizione
Ottiene un valore che indica se questo elemento è stato caricato per la presentazione.Gets a value that indicates whether this element has been loaded for presentation.
public:
property bool IsLoaded { bool get(); };
public bool IsLoaded { get; }
member this.IsLoaded : bool
Public ReadOnly Property IsLoaded As Boolean
Valore della proprietà
true
se l'elemento corrente è associato alla struttura ad albero di un elemento; false
se l'elemento non è mai stato associato alla struttura ad albero di un elemento caricato.true
if the current element is attached to an element tree; false
if the element has never been attached to a loaded element tree.
Esempi
Nell'esempio seguente vengono implementati due gestori: uno sta gestendo l'evento Loaded dell'elemento radice, quindi è certo che l'elemento radice della pagina venga caricato perché questo è il significato dell'evento.The following example implements two handlers: one is handling the Loaded event of the root element, so it is certain that the page root element is loaded because that is the significance of the event. L'altro gestore è associato a un controllo utente e chiama IsLoaded per assicurarsi che l'elemento radice venga caricato completamente.The other handler is hooked to a user control, and calls IsLoaded to assure that the root element is loaded completely. Entrambi i gestori chiamano la stessa funzione (non visualizzata) che compilerà gli elementi figlio con dati aggiornati.Both handlers call the same function (not shown) that will populate child elements with fresh data.
private void OnLoad(object sender, RoutedEventArgs e)
{
displayData();
}
private void updateSummary(object sender, RoutedEventArgs e)
{
if (GroupBoxPage.IsLoaded)
displayData();
}
Commenti
Da una FrameworkElementappena costruita, questa proprietà inizia false
e rimane true
dopo che è stata impostata su true
, anche se l'elemento viene successivamente rimosso da un albero logico connesso tramite codice.From a newly constructed FrameworkElement, this property starts off false
, and remains true
after it is set to true
, even if the element is subsequently removed from a connected logical tree by code. true
stato viene impostato dalla logica di presentazione generale quando gli elementi vengono caricati nel motore di presentazione.true
state is set by the general presentation logic when elements are loaded into the presentation engine.
Viene in genere eseguito il rendering degli elementi caricati, ma non tutte FrameworkElement classi derivate presentano una presentazione e altre proprietà come Visibility possono influenzare la presentazione.Typically, loaded elements are rendered, but not all FrameworkElement derived classes have a presentation, and other properties such as Visibility can influence presentation.