protected override void OnDetachingFrom(ContentPage bindable) { if (Device.RuntimePlatform == Device.UWP) { TreeView.ItemRightTapped -= TreeView_ItemRightTapped; KeyDetectorGrid.KeyPressed -= KeyDetectorGrid_KeyPressed; } else { TreeView.ItemHolding -= TreeView_ItemHolding; } TreeView.ItemTapped -= TreeView_ItemTapped; TreeView = null; popupLayout = null; KeyDetectorGrid = null; ViewModel = null; Node = null; base.OnDetachingFrom(bindable); }
protected override void OnAttachedTo(ContentPage bindable) { TreeView = bindable.FindByName <SfTreeViewExt>("treeView"); KeyDetectorGrid = bindable.FindByName <KeyDetector>("keyDetectorGrid"); ViewModel = bindable.BindingContext as FileManagerViewModel; InitializePopupLayout(); if (Device.RuntimePlatform == Device.UWP) { TreeView.ItemRightTapped += TreeView_ItemRightTapped; KeyDetectorGrid.KeyPressed += KeyDetectorGrid_KeyPressed; } else { TreeView.ItemHolding += TreeView_ItemHolding; } TreeView.ItemTapped += TreeView_ItemTapped; base.OnAttachedTo(bindable); }