Last active
May 8, 2020 16:04
-
-
Save luismts/bedb5483d79215d7f818774a6f473518 to your computer and use it in GitHub Desktop.
A comparison between classic C#, C# markup, and XAML for creating UI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var grid = new Grid(); | |
var label = new Label { Text = "Code:" }; | |
grid.Children.Add(label, 0, 1); | |
var entry = new Entry | |
{ | |
Placeholder = "Enter number", | |
Keyboard = Keyboard.Numeric, | |
BackgroundColor = Color.AliceBlue, | |
TextColor = Color.Black, | |
FontSize = 15, | |
HeightRequest = 44, | |
Margin = 20 | |
}; | |
grid.Children.Add(entry, 0, 2); | |
Grid.SetColumnSpan(entry, 2); | |
entry.SetBinding(Entry.TextProperty, new Binding("RegistrationCode")); | |
Content = grid; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Content = new Grid { | |
Children = { | |
new Label { Text = "Code:" }.Row(1), | |
new Entry { | |
Placeholder = "Enter number", | |
Keyboard = Keyboard.Numeric, | |
BackgroundColor = Color.AliceBlue, | |
TextColor = Color.Black | |
} | |
.Font(15) | |
.Row(2) | |
.ColumnSpan(2) | |
.Margin(20) | |
.Height(44) | |
.Bind("RegistrationCode") | |
}}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Content = new Grid | |
{ | |
Children = { | |
new Label { Text = "Code:" } | |
.Row(1), | |
new Entry { | |
Placeholder = "Enter number", | |
Keyboard = Keyboard.Numeric, | |
BackgroundColor = Color.AliceBlue, | |
TextColor = Color.Black | |
} | |
.Font(15) | |
.Row(2) | |
.ColumnSpan(2) | |
.Margin(20) | |
.Height(44) | |
.Bind("RegistrationCode") | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Content = new Grid { | |
Children = { | |
new Label { Text = "Code:" }.Row(1), | |
new Entry { | |
Placeholder = "Enter number", | |
Keyboard = Keyboard.Numeric, | |
BackgroundColor = Color.AliceBlue, | |
TextColor = Color.Black, | |
FontSize = 15, | |
HeightRequest = 44, | |
Margin = 20 | |
} | |
.Row(2) | |
.ColumnSpan(2) | |
.Bind("RegistrationCode") | |
}}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ContentPage.Content> | |
<Grid> | |
<Label Grid.Row="1" Text="Code:" /> | |
<Entry | |
Grid.Row="1" | |
Grid.ColumnSpan="2" | |
Margin="20" | |
BackgroundColor="AliceBlue" | |
FontSize="15" | |
HeightRequest="44" | |
Keyboard="Numeric" | |
Placeholder="Enter number" | |
Text="{Binding RegistrationCode}" | |
TextColor="Black" /> | |
</Grid> | |
</ContentPage.Content> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment