Improve the XAML Editor

This commit is contained in:
Frank A. Krueger 2017-12-10 20:17:35 -08:00
parent 0598645923
commit 9d50826c18
2 changed files with 15 additions and 6 deletions

View File

@ -3,6 +3,7 @@
<ContentPage.Content> <ContentPage.Content>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@ -10,8 +11,12 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Editor x:Name="editor" FontFamily="monospace" Grid.Row="0" Grid.Column="0" /> <StackLayout Orientation="Vertical" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
<ContentView x:Name="results" Grid.Row="0" Grid.Column="1" BackgroundColor="White" /> <Label Text="Xamarin.Forms XAML Editor" FontSize="24" FontAttributes="Bold" Margin="8,8,8,0" />
<Label Text="Edit the XAML below to see a live preview on the right" Margin="8,0,8,8" />
</StackLayout>
<Editor x:Name="editor" FontFamily="monospace" FontSize="12" Grid.Row="1" Grid.Column="0" />
<ContentView x:Name="results" Grid.Row="1" Grid.Column="1" BackgroundColor="White" />
</Grid> </Grid>
</ContentPage.Content> </ContentPage.Content>
</ContentPage> </ContentPage>

View File

@ -23,10 +23,14 @@ namespace Samples
<ColumnDefinition Width=""*"" /> <ColumnDefinition Width=""*"" />
<ColumnDefinition Width=""*"" /> <ColumnDefinition Width=""*"" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Text=""Top Left"" Grid.Row=""0"" Grid.Column=""0"" /> <StackLayout Grid.Row=""0"" Grid.Column=""0"">
<Label Text=""Top Right"" Grid.Row=""0"" Grid.Column=""1"" /> <Label Text=""Top Left"" />
<Label Text=""Bottom Left"" Grid.Row=""1"" Grid.Column=""0"" /> <Entry Placeholder=""I'm ready for some text"" />
<Label Text=""Bottom Right"" Grid.Row=""1"" Grid.Column=""1"" /> <Button Text=""I'm a button, but I don't do anything"" />
</StackLayout>
<Label Text=""Top Right"" Grid.Row=""0"" Grid.Column=""1"" TextColor=""White"" BackgroundColor=""#c5000b"" />
<Label Text=""Bottom Left"" Grid.Row=""1"" Grid.Column=""0"" TextColor=""Black"" BackgroundColor=""#ffd320"" />
<Label Text=""Bottom Right"" Grid.Row=""1"" Grid.Column=""1"" TextColor=""White"" BackgroundColor=""#008000"" />
</Grid> </Grid>
</ContentView>"; </ContentView>";
editor.TextChanged += (sender, e) => DisplayXaml (); editor.TextChanged += (sender, e) => DisplayXaml ();