1

I'm working on a mobile app in Xamarin.Forms, with a "new messages" bar at the bottom of the screen, like this:

----------------------
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|--------------------|
| 4 New Messages   ^ |
----------------------

When the user clicks on the bar at the bottom ("4 New Messages"), I want that bar to slide all the way to the top of the screen along with the list of message titles below it (that are initially hidden out of view), so that the whole messages area ("4 New Messages" title, plus the list of message title below it) should take up the full screen, like this:

----------------------
| 4 New Messages   X |
|--------------------|
| - Tomorrow Night   |
| - New product in...|
| - Outing cancelled |
| - Please call me   |
|                    |
|                    |
|                    |
----------------------

I can make the whole message area an absolute layout that takes up the full screen (parentElement.Children.Add(messagesArea, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);) and make it initially mostly hidden off the screen (except for the "4 New Messages" bar) using TranslateY; and then I can use TranslateTo(0, 0) to get it to slide back up to the full screen height.

BUT that assumes I know the height of the device. What's the best way to accomplish this in a device-independent way? And should I be using a Grid layout to begin with?

oguz ismail
  • 1
  • 16
  • 47
  • 69
jbyrd
  • 5,287
  • 7
  • 52
  • 86
  • 2
    get screen width and height: https://stackoverflow.com/questions/41489532/density-of-screen-in-ios-and-universal-windows-app/41510448#41510448 – Jason Oct 26 '17 at 20:21

0 Answers0