c# declarative fluent syntax
Content = new Grid {
RowSpacing = 0,
RowDefinitions = { new RowDefinition { Height = GridLength.Auto }, new RowDefinition {}},
Children = {
PageHeader.Create(PageMarginSize, nameof(vm.RegistrationTitle), returnToPreviousViewCommandPropertyName: nameof(vm.CancelEnterRegistrationCodeCommand), centerTitle:true),
new ScrollView { Content = new Grid {
RowDefinitions = {
new RowDefinition { Height = 170 },
new RowDefinition { Height = 75 },
new RowDefinition { Height = GridLength.Auto },
new RowDefinition { Height = GridLength.Auto }
},
RowSpacing = 0,
ColumnDefinitions = {
new ColumnDefinition { Width = 160 },
new ColumnDefinition { }
},
Children = {
new Label {
Margin = fieldNameMargin, LineBreakMode = LineBreakMode.WordWrap,
HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.Center,
}.SetFontSize(WspFontSizes.Size15)
.SetColRow(0, 2, 0, 1)
.Bind(nameof(vm.RegistrationPrompt)),
new Label { Text = "Registration code", VerticalOptions = LayoutOptions.End, Margin = fieldNameMargin }.SetFontSize(WspFontSizes.Size13)
.SetColRow(0, 1, 1, 2),
new Label { HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.End, Margin = fieldNameMargin }.SetFontSize(WspFontSizes.Size13)
.SetColRow(1, 2, 1, 2)
.Bind(nameof(vm.RegistrationCodeValidationMessage)),
new Entry {
Placeholder = "E.g. 123456", HeightRequest = 44, Keyboard = Keyboard.Numeric,
BackgroundColor = WspColors.White.ToColor(), TextColor = WspColors.Gray1.ToColor(), Margin = fieldMargin }.SetFontSize(WspFontSizes.Size15)
.Bind(nameof(vm.RegistrationCode), BindingMode.TwoWay)
.Id(AId.RegistrationCodePage_CodeEntry)
.SetColRow(0, 2, 2, 3),
new Button {
Text = "Verify",
Margin = PageMarginSize,
HeightRequest = 44,
HorizontalOptions = LayoutOptions.FillAndExpand,
TextColor = WspColors.White.ToColor(),
BackgroundColor = WspColors.ColorValueAccent.ToColor()
}.SetFontSize(WspFontSizes.Size13)
.Id(AId.RegistrationCodePage_VerifyCodeButton)
.Bind(Button.IsVisibleProperty, nameof(vm.CanVerifyRegistrationCode))
.Bind(nameof(vm.VerifyRegistrationCodeCommand))
.SetColRow(0, 2, 3, 4),
}
}}.SetColRow(0, 1)
}
};