I've tried two ListViews in Scroll View but the problem I've faced is that the data of second ListView is not fully displayed on the Page .
Here's is my code for that .
I've also tried this in StaclLayout but not getting the actual result.
@Anderw1993 - all of the guidance I have seen on this says to not put a ListView in a ScrollView (with the same orientation). Two ListViews in a StackLayout will work, but don't then be tempted to put that StackLayout in a ScrollView. When putting two ListViews in a StackLayout, you may find it necessary to specify HeightRequest on the ListViews.
Then is this possible to achieve that kinda result in Xamarin Forms ?
Both should be in One Scroll View but different ListView Header and Different ListView Border Radius ?
I know how to write custom renderer for that purpose but not sure Is this possible or Not ?
When I write a rounded custom renderer for ListView then ListView changes but it also changes the Header but I don't want this . What I want is a Rounded ListView and a Rounded ListView Header but both should be seperate .
Any help or hope for this ?
@Andrew1993 - Without the rounded corners on the list body, definitely. With the rounded corners, it take a bit more effort.
@JohnHardman . Don't worry about the ListView Custom Rendering
I've created the Header by using custom renderers and the following code
_commentsList.HeaderTemplate = new DataTemplate(() =>
ContentView topView = DynamicPostController.Instance.GetPostMainViewForModel(pModel) as ContentView;
but not sure how to handle the ListView ?
@Andrew1993 - Which aspect of the ListView are you not sure about?
I've created the ListView rounded Header but when I create the Custom Renderer for rounded ListView it will round the ListView from the top including the Header as well and if I create the StackLayout in the ViewCell then it will round all the ViewCell but what I want is a rounded ListView with rectangular ViewCells . Hope you understand the question ? @JohnHardman
@Andrew1993 - If you really need the body of the ListView to have rounded corners, I would do what you are not normally advised to do. That is, to have what is currently the Header of the ListView as a completely separate control, so that the ListView itself does not have a header. That way, your ListView custom renderer will apply the rounding to what appears to the user to be the body of the ListView, but is actually the whole ListView (the header being a separate control).
@JohnHardman Yeah you're right but may be this thing will disturb the Scrolling of ListView...
I've some thing in my mind that Is this possible to create a ListView in side the ListView means nested ListView ?
What you say ?
@Andrew1993 - Nesting a ListView inside a ListView will have the same UX implications as a ListView inside a ScrollView. Best avoided.
Im reading through the comments and i don't quite understand fully where the problem is... Is the problem with the UI not knowing when scrolling which object is trying to be scrolled?
If thats the case would it be ok to say make 2 listview which doesn't scroll and display all objects by increasing its Height and then proceed to put them into a scrollview?
@JohnHardman please clarify thanks.
"Note: ScrollViews should not be nested. In addition, ScrollViews should not be nested with other controls that provide scrolling, like ListView and WebView."
Re. putting non-scrolling ListViews inside a ScrollView - hmmm.... I'd call that a gray area. I think the Xamarin view would be that it's not supported. However, from a UX point of view, if it works then I think it should be ok, subject to caveats about pull-to-refresh etc.
@JohnHardman Oh I completely missed that when i went through that document... Yeah i did try that and it seems to be working ok on iOS and Android... i cant confirm for windows tho. Thanks for clearing that up
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies