FrameworkElement.IsInitialized Property


获取一个值,该值表示该元素是否在由 XAMLXAML 处理器进行处理时,或者通过显式调用其 EndInit() 方法被初始化。Gets a value that indicates whether this element has been initialized, either during processing by a XAMLXAML processor, or by explicitly having its EndInit() method called.

 property bool IsInitialized { bool get(); };
public bool IsInitialized { get; }
member this.IsInitialized : bool
Public ReadOnly Property IsInitialized As Boolean

Property Value


如果该元素按照前面提到的 XAMLXAML 处理或者方法调用已被初始化,则为 true;否则为 falsetrue if the element is initialized per the aforementioned XAMLXAML processing or method calls; otherwise, false.


如果此元素已在逻辑树中移动,以使其具有新的父元素,并因此再次加载,则此属性也可能 trueThis property may also be true if this element has been moved within the logical tree such that it has a new parent element, and therefore becomes reloaded again.

如果还在使用 BeginInitEndInit,则此属性很有用。This property is useful if you also are using BeginInit and EndInit. 可以确保初始化由 XAMLXAML 处理器加载的逻辑树中的元素。Elements in the logical tree that is loaded by a XAMLXAML processor are assured to be initialized. 调用 EndInit 时,将初始化不在逻辑树中的元素。Elements not in the logical tree are initialized when EndInit is called. 如果没有任何特定的 BeginInitEndInit处理,则在构造函数返回初始化的结果后,就会发生这种情况。In absence of any specific handling of BeginInit and EndInit, this will happen as soon as the constructor returns the initialized result.

Applies to