This topic has not yet been rated - Rate this topic

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)
protected virtual void Deactivate()

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.

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 override void Deactivate()
{
    adornedControlModel.PropertyChanged -= 
        new System.ComponentModel.PropertyChangedEventHandler(
            AdornedControlModel_PropertyChanged);
    base.Deactivate();
}


Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ