EditorPart.ApplyChanges 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
EditorPart 컨트롤의 값을 관련 WebPart 컨트롤의 해당 속성에 저장합니다.
public:
abstract bool ApplyChanges();
public abstract bool ApplyChanges ();
abstract member ApplyChanges : unit -> bool
Public MustOverride Function ApplyChanges () As Boolean
반환
EditorPart 컨트롤에서 WebPart 컨트롤로 값을 저장하는 작업이 성공하면 true
이고, 그렇지 않고 오류가 발생하면 false
입니다.
예제
다음 코드 예제에서는 사용자 지정 EditorPart 컨트롤에서 메서드를 ApplyChanges 구현 하는 방법을 보여 줍니다. 예제를 실행 하는 데 필요한 전체 코드의 예제 섹션을 참조 하세요.를 EditorPart 클래스 개요입니다.
코드 예제의 첫 번째 부분은 명명TextDisplayEditorPart
된 사용자 지정 EditorPart 클래스에서 메서드의 ApplyChanges 구현을 보여 줍니다. 이 메서드는 속성을 사용 하 여 연결 된 TextDisplayWebPart
컨트롤에 대 한 참조를 WebPartToEdit 가져옵니다. 그런 다음 속성 값을 TextDisplayWebPart.FontStyle
업데이트합니다.
public override bool ApplyChanges()
{
TextDisplayWebPart part =
(TextDisplayWebPart)WebPartToEdit;
// Update the custom WebPart control with the font style.
part.FontStyle = PartContentFontStyle.SelectedValue;
return true;
}
Public Overrides Function ApplyChanges() As Boolean
Dim part As TextDisplayWebPart = CType(WebPartToEdit, _
TextDisplayWebPart)
' Update the custom WebPart control with the font style.
part.FontStyle = PartContentFontStyle.SelectedValue
Return True
End Function
코드 예제의 두 번째 부분에서는 연결된 WebPart 컨트롤TextDisplayWebPart
이 메서드 구현에서 연결된 컨트롤의 컬렉션을 만드는 방법을 보여 줍니다(이 경우 컬렉션에 명명 TextDisplayEditorPart
된 EditorPart 컨트롤이 하나 EditorPart 만 있습니다)CreateEditorParts. 이 메서드는 컨트롤이 편집 모드로 TextDisplayWebPart
전환될 때 실행됩니다.
public override EditorPartCollection CreateEditorParts()
{
ArrayList editorArray = new ArrayList();
TextDisplayEditorPart edPart = new TextDisplayEditorPart();
edPart.ID = this.ID + "_editorPart1";
editorArray.Add(edPart);
EditorPartCollection editorParts =
new EditorPartCollection(editorArray);
return editorParts;
}
public override object WebBrowsableObject
{
get { return this; }
}
Public Overrides Function CreateEditorParts() _
As EditorPartCollection
Dim editorArray As New ArrayList()
Dim edPart as New TextDisplayEditorPart()
edPart.ID = Me.ID & "_editorPart1"
editorArray.Add(edPart)
Dim editorParts As New EditorPartCollection(editorArray)
Return editorParts
End Function
Public Overrides ReadOnly Property WebBrowsableObject() _
As Object
Get
Return Me
End Get
End Property
설명
메서드 ApplyChanges 는 컨트롤에 중요 한 메서드입니다 EditorPart . 클래스에서 EditorPart 추상 메서드로 정의되며 상속된 컨트롤에 의해 구현되어야 합니다. 이 메서드의 목적은 사용자가 컨트롤에 EditorPart 입력한 값을 속성에서 참조되는 컨트롤의 WebPart 해당 속성에 WebPartToEdit 저장하는 것입니다.
이 ApplyChanges 메서드는 사용자가 편집 UI(사용자 인터페이스)에서 확인을 나타내는 단추 또는 동사 적용을 클릭할 때 호출됩니다.
구현자 참고
클래스에서 파생되는 클래스는 메서드를 EditorPart ApplyChanges() 구현해야 합니다. 구현된 메서드는 속성을 사용하여 연결된 컨트롤에 WebPartToEdit 대한 참조를 가져오고 해당 컨트롤의 속성을 컨트롤의 현재 값 EditorPart 으로 업데이트합니다.