diff options
Diffstat (limited to 'Xamarin.Forms.Core/VisualElement.cs')
-rw-r--r-- | Xamarin.Forms.Core/VisualElement.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core/VisualElement.cs b/Xamarin.Forms.Core/VisualElement.cs index 053ddb0a..cff1eb10 100644 --- a/Xamarin.Forms.Core/VisualElement.cs +++ b/Xamarin.Forms.Core/VisualElement.cs @@ -781,5 +781,18 @@ namespace Xamarin.Forms public bool Result { get; set; } } + + ~VisualElement() + { + if (!GetIsDefault(BehaviorsProperty)) { + var behaviors = GetValue(BehaviorsProperty) as AttachedCollection<Behavior>; + behaviors.DetachFrom(this); + } + + if (!GetIsDefault(TriggersProperty)) { + var triggers = GetValue(TriggersProperty) as AttachedCollection<Trigger>; + triggers.DetachFrom(this); + } + } } }
\ No newline at end of file |