private void Item_OnTapped(object sender, EventArgs e) { DeviceOrientation deviceOrientation = (BindingContext as ViewModel.Cloud).DeviceOrientation; StackLayout prevSelectedElement = currentSelectedElement; if ((prevSelectedElement != null) && (prevSelectedElement.Children != null)) { var details = prevSelectedElement.Children.FirstOrDefault(c => c.GetType() == typeof(NotificationItemAccordionDetails)); if (details != null) { if (!details.IsVisible) { prevSelectedElement = null; } details.IsVisible = false; details.HeightRequest = 0; } } CustomViewCell currentCell = sender as CustomViewCell; if (currentCell != null) { currentSelectedElement = currentCell.FindByName <StackLayout>("notificationItem"); if ((currentSelectedElement != null) && !currentSelectedElement.Equals(prevSelectedElement)) { var details = currentSelectedElement.Children.FirstOrDefault(c => c.GetType() == typeof(NotificationItemAccordionDetails)); if (details != null) { details.IsVisible = (deviceOrientation == DeviceOrientation.Landscape) ? false : !details.IsVisible; details.HeightRequest = (details.IsVisible) ? getSelectedStackLayoutHeight() : 0; } else { double heightRequest = getSelectedStackLayoutHeight(); currentSelectedElement.Children.Add(new NotificationItemAccordionDetails() { BindingContext = BindingContext, HeightRequest = heightRequest, IsVisible = (heightRequest > 0) }); } } } }