예제 #1
0
 protected override void OnDetachingFrom(ContentPage bindable)
 {
     AddButton.Clicked += AddButton_Clicked;
     ListView           = null;
     AddButton          = null;
     ViewModel          = null;
     base.OnDetachingFrom(bindable);
 }
예제 #2
0
        protected override void OnAttachedTo(ContentPage bindable)
        {
            ListView  = bindable.FindByName <SfListView>("listView");
            AddButton = bindable.FindByName <Button>("addButton");

            ViewModel = new ContactsViewModel();
            ListView.BindingContext = ViewModel;

            AddButton.Clicked += AddButton_Clicked;

            base.OnAttachedTo(bindable);
        }
        public PagesViewModel(double height)
        {
            int j            = 0;
            int itemsPerPage = (int)(height / 100) * 3;
            int temp         = itemsPerPage;

            CarouselPages = new ObservableCollection <List <Contacts> >();
            var contactsviewmodel = new ContactsViewModel();

            var pageCount = Math.Ceiling((double)contactsviewmodel.ContactsInfo.Count / itemsPerPage);

            for (int i = 0; i < pageCount; i++)
            {
                var source = contactsviewmodel.ContactsInfo.Skip(j).Take(temp);
                var items  = source.AsEnumerable().ToList();
                CarouselPages.Add(items);
                j += itemsPerPage;
            }
        }