更新后,内部网格不可见xamarin.forms

时间:2018-06-13 05:27:36

标签: gridview xamarin.forms

我有两个嵌套的网格。第一个网格视图有一个图像和另一个网格视图。

myGrid = new Grid();

        VisualStateManager.GoToState(backgroundImage, orienttaion);
        myGrid.Children.Add(backgroundImage);
        myGrid.LowerChild(backgroundImage);

        var innerGrid = new Grid();
        innerGrid.RowSpacing = 10;
        innerGrid.VerticalOptions = LayoutOptions.End;
        innerGrid.BackgroundColor = Color.Yellow;

        innerGrid.RowDefinitions = new RowDefinitionCollection();
        innerGrid.ColumnDefinitions = new ColumnDefinitionCollection();
        innerGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
        innerGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
        innerGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
        innerGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
        innerGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
        innerGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });


        //user name
        Entry username = new Entry();
        username.BackgroundColor = Color.White;
        username.Margin = new Thickness(20, 0, 20, 0);
        username.TextColor = Color.White;
        innerGrid.Children.Add(username, 0, 3);
        Grid.SetColumnSpan(username, 4);



        //password
        Entry password = new Entry();
        password.BackgroundColor = Color.White;
        password.Margin = new Thickness(20, 0, 20, 0);
        password.TextColor = Color.White;
        innerGrid.Children.Add(password, 0, 4);
        Grid.SetColumnSpan(password, 4);


        //Login button
        Button login = new Button();
        login.Margin = new Thickness(20, 0, 20, 0);
        login.Text = "Login";
        login.BackgroundColor = _theme != null ? _theme.PrimaryColour : Color.Purple;
        login.TextColor = _theme != null ? _theme.PrimaryComplimentaryColour : Color.White;
        innerGrid.Children.Add(login, 0, 5);
        Grid.SetColumnSpan(login, 2);

        myGrid.Children.Add(innerGrid);
        myGrid.RaiseChild(innerGrid);


        Content = myGrid;

这很好用。问题是在我将xamarin.forms更新为3.0.0.550146之后,内部网格是不可见的。我怎么能解决这个问题?请帮我。 谢谢

0 个答案:

没有答案