void UntrackTarget(Page page) { if (page == null) { return; } if (page is MasterDetailPage) { _masterDetails--; } ((ObservableCollection <ToolbarItem>)page.ToolbarItems).CollectionChanged -= OnCollectionChanged; page.Descendants().OfType <Page>().ForEach(UnregisterChildPage); page.DescendantAdded -= OnChildAdded; page.DescendantRemoved -= OnChildRemoved; page.PropertyChanged -= OnPropertyChanged; }
void UntrackTarget(Page page) { if (page == null) return; if (page is MasterDetailPage) _masterDetails--; ((ObservableCollection<ToolbarItem>)page.ToolbarItems).CollectionChanged -= OnCollectionChanged; page.Descendants().OfType<Page>().ForEach(UnregisterChildPage); page.DescendantAdded -= OnChildAdded; page.DescendantRemoved -= OnChildRemoved; page.PropertyChanged -= OnPropertyChanged; }