コード例 #1
0
        private void LayoutActualContentView()
        {
            var frame = ContentView.Frame;

            frame.X -= panDeltaX;
            actualContentView.Frame = frame;

            if (panDeltaX < 0)
            {
                BackgroundView.Apply(Style.TimeEntryCell.ContinueState);
            }
            else if (panDeltaX > 0)
            {
                BackgroundView.Apply(Style.TimeEntryCell.DeleteState);
            }
            else
            {
                BackgroundView.Apply(Style.TimeEntryCell.NoSwipeState);
            }

            switch (panLock)
            {
            case PanLock.None:
                continueActionLabel.Alpha = (nfloat)Math.Min(1, Math.Max(0, -2 * panDeltaX / ContinueSwipeWidth - 1));
                var delAlpha = (nfloat)Math.Min(1, Math.Max(0, 2 * panDeltaX / DeleteSwipeWidth - 1));
                confirmActionLabel.Alpha = panDeleteConfirmed ? 0 : delAlpha;
                deleteActionLabel.Alpha  = panDeleteConfirmed ? delAlpha : 0;
                break;

            case PanLock.Left:
                continueActionLabel.Alpha = 1;
                confirmActionLabel.Alpha  = 0;
                deleteActionLabel.Alpha   = 0;
                break;

            case PanLock.Right:
                continueActionLabel.Alpha = 0;
                confirmActionLabel.Alpha  = panDeleteConfirmed ? 0 : 1;
                deleteActionLabel.Alpha   = panDeleteConfirmed ? 1 : 0;
                break;
            }
        }