コード例 #1
0
        void ToggleShowing(bool isShowing, bool animated)
        {
            if (_contentPage == null)
            {
                _contentPage = new YoutubeStyleContentPage();
                _contentPage.ParentHeight = Height;
                PageContainer.Content     = _contentPage;
                _panGesture           = new PanGestureRecognizer();
                _panGesture.OnAction += Gesture_OnAction;
                _panGesture.IsConsumingTouchesInParallel = true;
                _contentPage.VideoPlayerView.AddGestureRecognizer(_panGesture);
            }
            var minHeight = _contentPage.MinimumHeightRequest;
            var minWidth  = _contentPage.MinimumWidthRequest;

            _contentBounds.Y      = isShowing ? 0 : Height - minHeight;
            _contentBounds.X      = isShowing ? 0 : Width - minWidth;
            _contentBounds.Width  = isShowing ? Width : minWidth;
            _contentBounds.Height = isShowing ? Height : minHeight;

            if (MediaItemsListView.SelectedItem != null)
            {
                _contentPage.Item = MediaItemsListView.SelectedItem as MediaItem;
            }
            if (animated)
            {
                PageContainer.LayoutTo(_contentBounds);
            }
            else
            {
                PageContainer.Layout(_contentBounds);
            }
        }