private static void DefaultHeightChanged(BindableObject bindable, object oldValue, object newValue) { SlideMenu m = bindable as SlideMenu; if (m == null) { return; } m.IsVisible = false; m.TranslationY = (double)newValue; }
private static void ModeChanged(BindableObject bindable, object oldValue, object newValue) { SlideMenu m = bindable as SlideMenu; if (m == null) { return; } if (newValue.ToString() == "Top") { m.HeightRequest = 600; m.MainStackLayout.HorizontalOptions = LayoutOptions.FillAndExpand; m.MainStackLayout.VerticalOptions = LayoutOptions.End; m.slideLength = 400; m.slideSpeed = 400; m.easingStyleIn = m.easingStyleOut = Easing.SpringOut; } else if (newValue.ToString() == "Bottom") { m.HeightRequest = 600; m.MainStackLayout.HorizontalOptions = LayoutOptions.FillAndExpand; m.MainStackLayout.VerticalOptions = LayoutOptions.End; m.slideLength = 400; m.slideSpeed = 400; m.easingStyleIn = m.easingStyleOut = Easing.SpringOut; } else if (newValue.ToString() == "Left") { m.WidthRequest = 600; m.MainStackLayout.HorizontalOptions = LayoutOptions.Start; m.MainStackLayout.VerticalOptions = LayoutOptions.FillAndExpand; m.slideLength = 400; m.slideSpeed = 400; m.easingStyleIn = m.easingStyleOut = Easing.SpringOut; } else if (newValue.ToString() == "Message") { m.HeightRequest = 80; m.slideLength = 300; m.slideSpeed = 250; m.easingStyleIn = Easing.SinInOut; m.easingStyleOut = Easing.SinInOut; } }
private static async void IsSlideOpenClose(BindableObject bindable, object oldValue, object newValue) { SlideMenu m = bindable as SlideMenu; if (m == null) { return; } if (m.Mode == "Top") { if ((bool)newValue) { m.IsVisible = true; await m.TranslateTo(0, App.ScreenHeight - m.slideLength, m.slideSpeed, m.easingStyleIn); newValue = false; } else { await m.TranslateTo(0, App.ScreenHeight, m.slideSpeed, m.easingStyleOut); m.IsVisible = false; newValue = true; } } else if (m.Mode == "Bottom") { if ((bool)newValue) { m.IsVisible = true; await m.TranslateTo(0, App.ScreenHeight - m.slideLength, m.slideSpeed, m.easingStyleIn); newValue = false; } else { await m.TranslateTo(0, App.ScreenHeight, m.slideSpeed, m.easingStyleOut); m.IsVisible = false; newValue = true; } } else if (m.Mode == "Left") { if ((bool)newValue) { m.IsVisible = true; await m.TranslateTo(App.ScreenWidth - m.slideLength, 0, m.slideSpeed, m.easingStyleIn); newValue = false; } else { await m.TranslateTo(App.ScreenWidth, m.slideSpeed, 0, m.easingStyleOut); m.IsVisible = false; newValue = true; } } }