InkPresenter.DetachVisuals(Visual) Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Desanexa o visual do DynamicRendererInkPresenter.
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)
Parâmetros
- visual
- Visual
O visual do DynamicRenderer desanexar.
Exceções
visual não está anexado ao InkPresenter.
Exemplos
O exemplo a seguir anexa novamente o visual de um DynamicRenderer ao InkPresenter sempre que estiver DrawingAttributes nas alterações. Este exemplo pressupõe que o AttributeChanged evento esteja anexado ao manipulador de eventos.
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
Comentários
Quando o DrawingAttributes controle em um personalizado é alterado, o visual deve DynamicRenderer ser anexado novamente ao InkPresenter. Chame o e DetachVisuals os AttachVisuals métodos para anexar novamente o visual ao InkPresenter.