protected override void OnAttachedTo(SampleView bindable) { ListView = bindable.FindByName <Syncfusion.ListView.XForms.SfListView>("listView"); ListView.ItemHolding += ListView_ItemHolding; ListView.SelectionChanged += ListView_SelectionChanged; if (Device.RuntimePlatform == Device.UWP) { ListView.FocusBorderThickness = new Thickness(1, 1, 1, 2); } SelectionViewModel = new ListViewSelectionViewModel(); ListView.BindingContext = SelectionViewModel; ListView.ItemsSource = SelectionViewModel.MusicInfo; headerGrid = bindable.FindByName <Grid>("headerGrid"); headerGrid.BindingContext = SelectionViewModel; selectionCancelImageParent = bindable.FindByName <Grid>("cancelImageParent"); var selectionCancelImageTapped = new TapGestureRecognizer() { Command = new Command(selectionCancelImageTapped_Tapped) }; selectionCancelImageParent.GestureRecognizers.Add(selectionCancelImageTapped); selectionEditImageParent = bindable.FindByName <Grid>("editImageParent"); var selectionEditImageTapped = new TapGestureRecognizer() { Command = new Command(SelectionEditImageTapped_Tapped) }; selectionEditImageParent.GestureRecognizers.Add(selectionEditImageTapped); base.OnAttachedTo(bindable); }
protected override void OnDetachingFrom(SampleView bindable) { ListView.ItemHolding -= ListView_ItemHolding; ListView.SelectionChanged -= ListView_SelectionChanged; ListView = null; selectionCancelImageParent = null; selectionEditImageParent = null; SelectionViewModel = null; headerGrid = null; base.OnDetachingFrom(bindable); }