private void TapGestureRecognizer_Tapped(object sender, EventArgs e) { var mainDisplayInfo = DeviceDisplay.MainDisplayInfo; double end = mainDisplayInfo.Height > mainDisplayInfo.Width ? mainDisplayInfo.Height : mainDisplayInfo.Width; double endHeight = end / 3; if (DeviceInfo.Idiom == DeviceIdiom.Phone) { endHeight = end / 5; } if (MyDraggableView.Height == 0) { Action <double> callback = input => MyDraggableView.HeightRequest = input; double startHeight = 0; uint rate = 32; uint length = 500; Easing easing = Easing.CubicOut; MyDraggableView.Animate("anim", callback, startHeight, endHeight, rate, length, easing); } else { Action <double> callback = input => MyDraggableView.HeightRequest = input; double startHeight = endHeight; uint rate = 32; uint length = 500; Easing easing = Easing.SinOut; MyDraggableView.Animate("anim", callback, startHeight, 0, rate, length, easing); } }
private void Animation(Action <double> callback, double strartHeigth, double endHeigth, uint rate, Easing easing) { uint length = 500; MyDraggableView.Animate("anim", callback, strartHeigth, endHeigth, rate, length, easing); }
//private void CloseTextInput() private void CloseTextInput(object sender, EventArgs e) { var mainDisplayInfo = DeviceDisplay.MainDisplayInfo; Action <double> callback = input => MyDraggableView.HeightRequest = input; double startHeight = mainDisplayInfo.Height / 4; double endHeight = 0; uint rate = 32; uint length = 500; Easing easing = Easing.SinOut; MyDraggableView.Animate("anim", callback, startHeight, endHeight, rate, length, easing); }
// private void OpenCloseTextInput(object sender, EventArgs e) // { // // var mainDisplayInfo = DeviceDisplay.MainDisplayInfo; // // // if (MyDraggableView.Height == 0) // { // Action<double> callback = input => MyDraggableView.HeightRequest = input; // double startHeight = 0; // double endHeight = mainDisplayInfo.Height / 6; // uint rate = 32; // uint length = 500; // Easing easing = Easing.CubicOut; // MyDraggableView.Animate("anim", callback, startHeight, endHeight, rate, length, easing); // } // else // { // Action<double> callback = input => MyDraggableView.HeightRequest = input; // double startHeight = mainDisplayInfo.Height / 6; // double endiendHeight = 0; // uint rate = 32; // uint length = 500; // Easing easing = Easing.SinOut; // MyDraggableView.Animate("anim", callback, startHeight, endiendHeight, rate, length, easing); // // } // } private void OpenTextInput() { var mainDisplayInfo = DeviceDisplay.MainDisplayInfo; Action <double> callback = input => MyDraggableView.HeightRequest = input; double startHeight = 0; double endHeight = mainDisplayInfo.Height / 4; uint rate = 32; uint length = 500; Easing easing = Easing.SinOut; MyDraggableView.Animate("anim", callback, startHeight, endHeight, rate, length, easing); txtEntry.Focus(); }