Forum Xamarin.Forms

Slide up hidden panel height issue

DarrenKayDarrenKay GBUniversity ✭✭

Trying to create a slide up filter/sort panel in one of our screens. I looked at some code/xaml in and used an idea from that but in a more basic implementation.

So I have the filter pane in the ContentPage like so;

TranslationY="{Binding Source={x:Reference RootPage}, Path=Height}" />

Some code in the code behind file;

private void FilterSort_Clicked(object sender, EventArgs e)
  var pageHeight = Height;
  PageFader.IsVisible = true;
  PageFader.FadeTo(1, AnimationSpeed, Easing.SinInOut);
  FilterSortOptions.TranslateTo(0, pageHeight * 0.6, AnimationSpeed, Easing.SinInOut);

I am sliding panel up using the pageHeight * 0.6 calculation as the view content uses that much area. To allow me to change the view I wanted to use the view height as part of the calculate for sliding the panel up onto the screen. When I query the height of the view it is always -1?

Any ideas on how I can dynamically calculate the view height so I slide it up the correct size?


Sign In or Register to comment.