private void TapGestureRecognizer_Tapped(object sender, EventArgs e)
        {
            var image       = (sender as Image);
            var groupResult = image.BindingContext as GroupResult;

            if (groupResult == null)
            {
                return;
            }

            var items = groupResult.Items.ToList <MusicInfo>().ToList();

            if ((items.All(listItem => listItem.IsSelected == true)))
            {
                for (int i = 0; i < items.Count(); i++)
                {
                    var item = items[i];
                    (item as MusicInfo).IsSelected = false;
                }
            }
            else if ((items.All(listItem => listItem.IsSelected == false)))
            {
                for (int i = 0; i < items.Count(); i++)
                {
                    var item = items[i];
                    (item as MusicInfo).IsSelected = true;
                }
            }

            this.RefreshGroupHeader(groupResult);
            ListView.RefreshView();
        }
コード例 #2
0
 private void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (ListView.DataSource != null)
     {
         ListView.DataSource.Filter = FilterContacts;
         ListView.DataSource.RefreshFilter();
     }
     ListView.RefreshView();
 }
コード例 #3
0
 private void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (ListView.ItemsSource != null && (e.NewTextValue.Length >= 3 || e.NewTextValue.Length == 0))
     {
         ListView.DataSource.Filter = FilterContacts;
         ListView.DataSource.RefreshFilter();
     }
     ListView.RefreshView();
 }
コード例 #4
0
 //Method 1 : Get SfListView reference using Grid.ChildAdded Event
 private void Grid_ChildAdded(object sender, ElementEventArgs e)
 {
     if (e.Element is SfListView)
     {
         listView = e.Element as SfListView;
         listView.RefreshView();
     }
     if (e.Element is Button)
     {
         button          = e.Element as Button;
         button.Clicked += Button_Clicked;
     }
 }
コード例 #5
0
        private void AddButton_Clicked(object sender, EventArgs e)
        {
            var viewModel = (sender as Button).BindingContext as ContactsViewModel;

            viewModel.ContactsInfo.Add(new Contacts()
            {
                ContactName = "John", ContactImage = ImageSource.FromResource("ListViewXamarin.Images.Image" + 5 + ".png"), ContactNumber = "721-821"
            });

            Device.BeginInvokeOnMainThread(() =>
            {
                var groupCount = ListView.DataSource.Groups.Count;
                ListView.DataSource.Groups.MoveTo(groupCount - 1, 0);
                ListView.RefreshView();
            });
        }