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) 。 如果您需要將編輯的值儲存在使用者動作之外,您也可以直接從自己的程式碼呼叫它。

適用於

另請參閱