Share via


AdornerProvider.Deactivate Method

Called when an adorner provider is about to be discarded by the designer.

Namespace:  Microsoft.Windows.Design.Interaction
Assembly:  Microsoft.Windows.Design.Interaction (in Microsoft.Windows.Design.Interaction.dll)

Syntax

'Declaration
Protected Overridable Sub Deactivate
protected virtual void Deactivate()
protected:
virtual void Deactivate()
abstract Deactivate : unit -> unit 
override Deactivate : unit -> unit 
protected function Deactivate()

Remarks

The Deactivate method is called before the adorners are removed from the designer user interface (UI).

Use the Deactivate method to detach event handlers which you attached earlier in the lifetime of the AdornerProvider.

An AdornerProvider instance may be activated and deactivated several times during its lifetime. Implement the Activate and Deactivate methods accordingly.

Examples

The following code example shows how to override the Deactivate method. For more information, see Walkthrough: Creating a Design-time Adorner.

' The following method deactivates the adorner.
Protected Overrides Sub Deactivate()
    RemoveHandler adornedControlModel.PropertyChanged, _
        AddressOf AdornedControlModel_PropertyChanged
    MyBase.Deactivate()

End Sub
// The following method deactivates the adorner.
protected override void Deactivate()
{
    adornedControlModel.PropertyChanged -= 
        new System.ComponentModel.PropertyChangedEventHandler(
            AdornedControlModel_PropertyChanged);
    base.Deactivate();
}

.NET Framework Security

See Also

Reference

AdornerProvider Class

Microsoft.Windows.Design.Interaction Namespace

Other Resources

Adorner Architecture

Walkthrough: Creating a Design-time Adorner