語言

InkPresenter.DetachVisuals(Visual) 方法

定義

將 的視覺DynamicRenderer與 分離。InkPresenter

public:
 void DetachVisuals(System::Windows::Media::Visual ^ visual);
public void DetachVisuals(System.Windows.Media.Visual visual);
member this.DetachVisuals : System.Windows.Media.Visual -> unit
Public Sub DetachVisuals (visual As Visual)

參數

visual
Visual

視覺上 DynamicRenderer 要分離。

例外狀況

visual不與 連接。InkPresenter

範例

以下範例在變動時重新附加 a DynamicRenderer 的視覺化到。InkPresenterDrawingAttributes 此範例假設 AttributeChanged 事件已附加到事件處理程序。

void DrawingAttributesChanged(object sender, PropertyDataChangedEventArgs e)
{
    // Reattach the visual of the DynamicRenderer to the InkPresenter 
    // whenever the DrawingAttributes change.
    presenter.DetachVisuals(renderer.RootVisual);
    presenter.AttachVisuals(renderer.RootVisual, renderer.DrawingAttributes);
}
Private Sub DrawingAttributesChanged(ByVal sender As Object, ByVal e As PropertyDataChangedEventArgs)

    ' Reattach the visual of the DynamicRenderer to the InkPresenter 
    ' whenever the DrawingAttributes change.
    presenter.DetachVisuals(renderer.RootVisual)
    presenter.AttachVisuals(renderer.RootVisual, renderer.DrawingAttributes)

End Sub

備註

當 DrawingAttributes 自訂控制變更時, DynamicRenderer 必須重新附加到 InkPresenter。 呼叫 和 DetachVisualsAttachVisuals 方法,將視覺化重新附加到 InkPresenter。

適用於