Share via


ControlTemplate.ValidateTemplatedParent(FrameworkElement) 方法

定義

請依一組規則來檢查樣版化父代 (Parent)。

protected:
 override void ValidateTemplatedParent(System::Windows::FrameworkElement ^ templatedParent);
protected override void ValidateTemplatedParent (System.Windows.FrameworkElement templatedParent);
override this.ValidateTemplatedParent : System.Windows.FrameworkElement -> unit
Protected Overrides Sub ValidateTemplatedParent (templatedParent As FrameworkElement)

參數

templatedParent
FrameworkElement

這個樣板要套用的項目。

例外狀況

templatedParent 不可以是 null

在使用 ControlTemplate 上的 Control 之前,您必須藉由設定 Template 屬性,使 ControlTemplateControl 相關聯。

備註

方法會使用下列規則:

  1. templatedParent不能是 型別 FrameworkContentElement

  2. templatedParent不可以是 不是 Control 的類型 FrameworkElement

  3. templatedParent不可以是 Control 未與 ControlTemplate 相關聯的 。

適用於