PropertyGridEditorPart.ApplyChanges 方法

定義

將值從 PropertyGridEditorPart 控制項儲存至相關聯 WebPart 控制項中相應的屬性。

public:
 override bool ApplyChanges();
public override bool ApplyChanges ();
override this.ApplyChanges : unit -> bool
Public Overrides Function ApplyChanges () As Boolean

傳回

如果將值從 PropertyGridEditorPart 儲存至 WebPart 的動作順利進行,則為 true,否則 (如果發生錯誤) 為 false

例外狀況

嘗試為相關聯 WebPart 上的屬性設定值時發生錯誤。

備註

方法 ApplyChanges 是控件上 PropertyGridEditorPart 的重要方法。 方法會將使用者在控件上 PropertyGridEditorPart 設定的值儲存到相關聯 WebPart 控件中的對應屬性。 相關聯的控件是在控件的繼承WebPartToEdit屬性中PropertyGridEditorPart參考。

重要

您無法覆寫 ApplyChanges 方法, PropertyGridEditorPart 因為類型已密封,以防止繼承自該方法。 不過,如果您需要比控件所提供的更多編輯各種 WebPart 控件屬性 PropertyGridEditorPart 的程序設計控件,您可以建立自定義 EditorPart 控件並提供自己的此方法實作。 如需程式代碼範例,請參閱 ApplyChanges 方法。

方法 ApplyChanges 會嘗試在相關聯的 WebPart 控件中設定公用自定義屬性的值,前提是這些屬性各有屬性 [WebBrowsable(true)]

ApplyChanges當使用者在編輯使用者介面中按兩下代表OK的按鈕或套用動詞命令時,會呼叫方法, (UI) 。 如果您需要將編輯的值儲存在用戶動作之外,您也可以直接從自己的程式碼呼叫它。

適用於

另請參閱