Xamarin forma Grid-Row height of " * " in C#?
Eu sei que você pode definir a altura da linha com um " * " em XAML desta forma:
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
mas a mesma expressão em C# devolve um erro:
new RowDefinition { Height = new GridLength("*", GridUnitType.Auto) },
então a minha pergunta é como definir a altura da linha de uma grelha para um " * " em C#?
8
Author: Ilia Stoilov, 2015-08-14
1 answers
var grid = new Grid ();
grid.RowDefinitions.Add (new RowDefinition { Height = GridLength.Auto });
grid.RowDefinitions.Add (new RowDefinition { Height = new GridLength (1, GridUnitType.Star) });
var stacklayout1 = new StackLayout { HeightRequest = 100, BackgroundColor = Color.Red };
var stacklayout2 = new StackLayout { BackgroundColor = Color.Blue };
Grid.SetRow (stacklayout2, 1);
grid.Children.Add (stacklayout1);
grid.Children.Add (stacklayout2);
MainPage = new ContentPage { Content = grid };
17
Author: Rui Marinho, 2015-08-17 15:12:17