Skip to content

Setting the SwipeState of the SwipeView from the view model has no effect if the left and right content has not been displayed. #120

Description

@chungchien

I debugged the source code and found that it was because _leftContainer.Bounds and _rightContainer.Bounds were not calculated if they were not displayed before.

I modified ProcessSwipe as follows, then it works as expected.

    private void ProcessSwipe(SwipeState state)
    {
        switch (state)
        {
            case SwipeState.RightVisible:
                _rightContainer.IsVisible = true;
                MaterializeDataTemplate(_rightContainer, Right);
                SetTranslate(-_rightContainer.Bounds.Width);

                break;
            case SwipeState.LeftVisible:
                _leftContainer.IsVisible = true;
                MaterializeDataTemplate(_leftContainer, Left);
                SetTranslate(_leftContainer.Bounds.Width);

                break;
            case SwipeState.Hidden:
            default:
                SetTranslate(0);
                break;
        }
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions