I'm making an AutoCompleteBox, and I'm stacking a
ListView on on the other.
I have two questions:
1) How do I shrink the
ListView's height to expand only what's necessary for its items to display, but no more than a certain size?
2) I want the view's size to be as the size of the
SearchBar, but I want it to stick out from the bottom and cover the elements coming afterwards. I think I want to use either
I looked at the examples of
AbsoluteLayout, but all of them is in a case where the layout takes up the whole screen.
In this image (from the example), the layout (red border) is sized according the
SearchBar, and the
ListView (orange) has its width set to the
SearchBar, but sticks outside downwards covering elements behind it.
Here's my experiment:
_Container = (AbsoluteLayout)_Container; _ListView.HeightRequest = 150; //shouldn't exceed, am I wrong? How to set max height? _ListView.VerticalOptions = LayoutOptions.Start; _Container.Children.Add(SearchBar); _Container.Children.Add(_ListView); _Container.VerticalOptions = LayoutOptions.Start; AbsoluteLayout.SetLayoutFlags(SearchBar, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(SearchBar, new Rectangle(.5, 1, SearchBar.Height, SearchBar.Width)); AbsoluteLayout.SetLayoutFlags(_ListView, AbsoluteLayoutFlags.WidthProportional); AbsoluteLayout.SetLayoutBounds(_ListView, new Rectangle(0, 0, SearchBar.Width, _ListView.Height));
RelativeLayout a better solution?