Rediger

Del via


InkPresenter.DetachVisuals(Visual) Method

Definition

Detaches the visual of the DynamicRenderer from the 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)

Parameters

visual
Visual

The visual of the DynamicRenderer to detach.

Exceptions

visual is not attached to the InkPresenter.

Examples

The following example re-attaches the visual of a DynamicRenderer to the InkPresenter whenever the DrawingAttributes on the changes. This example assumes that the AttributeChanged event is attached to the event handler.

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

Remarks

When the DrawingAttributes on a custom control changes, the visual of the DynamicRenderer must be re-attached to the InkPresenter. Call the DetachVisuals and AttachVisuals methods to re-attach the visual to the InkPresenter.

Applies to