Xamarin.Forms: How to expand row from listview over full screen after tap or click?
Asked Answered
C

1

2

I have two cell templates that appears in ListView. After clicking or taping on a cell, loading the second expanded (resized) template which is longer and shows more information. Problem is that I would like second template to expand and extend over the entire screen (from the toolbar to the bottom), not only as much as the content of template. To be perfectly clear, I do not want to open up a new window (Navigation.PushAsync), but to expand whole content in full screen. For now I have a way to fix the height of the extended cell after clicking, but that's not what I want, because every mobile device is different and has a different resolution.

Is there any easy way to do this, or I have to use some Nuget?

Thanks in advance!

Cardcarrying answered 25/11, 2016 at 14:6 Comment(2)
Why don't you want to open up a new window? From your description, that seems like it would give the effect you want, though Navigation.PushModalAsync might be better in your case than PushAsync, as it would cover more of the screen.Ungulate
@Ungulate Unfortunately, I can't open new window, becouse my boss required that the active row (cell) spread across the entire screen (except toolbar) and to look expanded, not opened. Maybe like animation...Cardcarrying
G
1

For list view cell you could use a grid. Then binding width and height with a column definition. How to do it you can find on the internet. Screen width and height you can get in platform specific project. On android width you can get like that:

App.ScreenWidth = ( int )( Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density );

Something similar will be with height.

Gluey answered 27/11, 2016 at 11:44 Comment(3)
Thanks very much, but after set width and height, I need extended cell to be at the top of the screen and to cover entire screen.Cardcarrying
I did it. After using App.ScreenWidth and Height, I put this line of code myList.ScrollTo(e.SelectedItem, ScrollToPosition.Start, true); in click event to move selected row at the top of the screen. Thanks again ;-)Cardcarrying
Happy that you solved it. For me, it is also interesting, how you did it. :)Gluey

© 2022 - 2024 — McMap. All rights reserved.