예제 #1
0
파일: Issue8503.cs 프로젝트: lhx11187/maui
            private static async Task DoAnimationByType(EAnimationType animationType, View obj, Easing easing, double scale)
            {
                LoginAnimationStackLayout stack = obj as LoginAnimationStackLayout;

                if (stack == null)
                {
                    return;
                }

                switch (animationType)
                {
                case EAnimationType.Translation:
                    await DoTranslation(stack, obj, easing);

                    break;

                case EAnimationType.Scale:
                    await DoScale(stack, easing, scale);

                    break;

                default:
                    stack.IsVisible = stack.Visible;
                    break;
                }
            }
예제 #2
0
파일: Issue8503.cs 프로젝트: lhx11187/maui
            private static async Task DoTranslation(LoginAnimationStackLayout stackLayout, View obj, Easing easing)
            {
                if (stackLayout.Visible)
                {
                    stackLayout.IsVisible = true;

                    if (!yPosition.HasValue)
                    {
                        yPosition = obj.TranslationY;
                    }

                    await stackLayout.TranslateTo(obj.TranslationX, obj.TranslationY - 10, 10, easing);

                    await stackLayout.TranslateTo(obj.TranslationX, obj.TranslationY + 10, 900, easing);
                }
                else
                {
                    if (!yPosition.HasValue)
                    {
                        yPosition = obj.TranslationY;
                    }

                    await stackLayout.TranslateTo(obj.TranslationX, obj.TranslationY, 10, easing);

                    await stackLayout.TranslateTo(obj.TranslationX, obj.TranslationY - 20, 900, easing);

                    obj.TranslationY = yPosition.Value;

                    stackLayout.IsVisible = false;
                }
            }
예제 #3
0
파일: Issue8503.cs 프로젝트: lhx11187/maui
            private static async Task DoScale(LoginAnimationStackLayout stackLayout, Easing easing, double scale)
            {
                if (stackLayout.Visible)
                {
                    stackLayout.IsVisible = true;

                    await stackLayout.ScaleTo(scale, 250, easing);

                    await stackLayout.ScaleTo(1.00, 250, easing);
                }
                else
                {
                    await stackLayout.ScaleTo(1.00, 250, easing);

                    await stackLayout.ScaleTo(scale, 250, easing);

                    stackLayout.IsVisible = false;
                }
            }
예제 #4
0
파일: Issue8503.cs 프로젝트: lhx11187/maui
        protected override void Init()
        {
            Title = "Issue 8503 [UWP] - text in Entry not visible until receiving focus";
            ScrollView scrollView = new ScrollView();

            StackLayout layout = new StackLayout {
                Margin = new Thickness(20, 0)
            };

            layout.BindingContext = this;

            Label isolatedHeader = new Label {
                Text = "Isolated Bug", Margin = new Thickness(0, 20), FontSize = 18
            };
            Label isolatedInstructions = new Label
            {
                Text = "This is the bug isolated. To test:\n" +
                       "Click on the button below, to show Entry for Isolated Bug.\n" +
                       "An Entry appears.\n" +
                       "Check that the entry contains text 'This text should be visible, even before acquiring focus'.\n" +
                       "If it does, the issue is fixed.\n" +
                       "If it does not, check if the text appears if the entry receives focus.\n" +
                       "If it does, the bug is not fixed."
            };

            isolatedEntry = new Entry {
                Text = "This text should be visible, even before acquiring focus", IsVisible = false
            };

            Button isolatedShowEntryButton = new Button {
                Text = "Click to show Entry for Isolated Bug"
            };

            isolatedShowEntryButton.Clicked += IsolatedShowEntryButton_Clicked;

            layout.Children.Add(isolatedHeader);
            layout.Children.Add(isolatedInstructions);
            layout.Children.Add(isolatedEntry);
            layout.Children.Add(isolatedShowEntryButton);

            Label issueHeader = new Label {
                Text = "Reported Bug", Margin = new Thickness(0, 20), FontSize = 18
            };
            Label issueInstructions = new Label
            {
                Text = "This is the bug as reported with an example\n" +
                       "Click on the login-action button.\n" +
                       "An Entry for a UserName appears with a little translating animation.\n" +
                       "Check that the entry contains text 'user name goes here'.\n" +
                       "If it does, the issue is fixed.\n" +
                       "If it does not, check if the text appears if the entry receives focus.\n" +
                       "If it does, the bug is there."
            };

            LoginAnimateBehavior bugBehavior = new LoginAnimateBehavior
            {
                EasingType    = EEasingType.SinInOut,
                AnimationType = EAnimationType.Translation
            };

            StackLayout issueStackLayout = new StackLayout();
            LoginAnimationStackLayout animatedStackLayout = new LoginAnimationStackLayout
            {
                IsVisible = false
            };

            animatedStackLayout.SetBinding(LoginAnimationStackLayout.VisibleProperty, nameof(IsUserNameEntryVisible));
            animatedStackLayout.Behaviors.Add(bugBehavior);

            Entry loginUserNameEntry = new Entry
            {
                IsEnabled = true
            };

            loginUserNameEntry.SetBinding(Entry.TextProperty, nameof(UserName));

            Button loginButton = new Button
            {
                Text         = "Login_Action",
                WidthRequest = 150
            };

            loginButton.Clicked += LoginButton_Clicked;

            animatedStackLayout.Children.Add(loginUserNameEntry);

            issueStackLayout.Children.Add(animatedStackLayout);
            issueStackLayout.Children.Add(loginButton);

            layout.Children.Add(issueHeader);
            layout.Children.Add(issueInstructions);
            layout.Children.Add(issueStackLayout);

            scrollView.Content = layout;
            Content            = scrollView;
        }