Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Graphic problem, layout with searchbar and listview last cell out of screen

$
0
0

Hi, I create a Page with a SearchBar and a ListView, I also implemented this so I'll load new element when reaching the end of the screen. Now it happens that the last element is out of the screen, half cutted, the same size of the SearchBar.
Here is the code for the ListView:

public class SearchByTextListView : ListView
    {
        ProductSearchMainViewModel _viewModel;

        public SearchByTextListView ()
        {
            ItemTemplate = new DataTemplate (typeof(SearchResultCell));
            HasUnevenRows = true;
            BackgroundColor = MyTeam.Assets.Style.GetCommunicationListColor ();
            VerticalOptions = LayoutOptions.FillAndExpand;
            ItemSelected += RowSelected;
        }

        void RowSelected (object sender, SelectedItemChangedEventArgs e)
        {
            var prod = (ProductItemSource)e.SelectedItem;
            GoToProductPage (prod);
        }

        public void GoToProductPage(ProductItemSource product)
        {
            var view = new ProductView (product);
            Navigation.PushAsync (view);
        }

And here is the Page, I'll start with another view instead of the list view, but in the method XXX I'll set the list viev

CONSTRUCTOR
_layout = new StackLayout () {
                Children = {
                    _searchBar,
                    contentView
                },
                Spacing = 0,
            };
Content = _layout;


public void ChangeView() // this will set the listview instead of contentView
        {
            Device.BeginInvokeOnMainThread (() => {
                _layout.Children.RemoveAt (_layout.Children.Count-1);
                listView = new SearchByTextListView ();
                    listView.SetBinding (ListView.ItemsSourceProperty, "SearchResults");
                    listView.ItemAppearing += async (sender, e) => _viewModel.SearchByTextListView_ItemAppearing(sender,e);
                AddView (listView);
            });
        }

Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>