Skip to content

Instantly share code, notes, and snippets.

@atwalsh
Last active August 29, 2015 14:18
Show Gist options
  • Save atwalsh/e2e65aceb27d2c731a82 to your computer and use it in GitHub Desktop.
Save atwalsh/e2e65aceb27d2c731a82 to your computer and use it in GitHub Desktop.
textBlock example

When the TextBlock is not commented out: layout

I'm getting errors in my MainPage.xaml.cs: errors

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace App2
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
TextBlock textBlock2 = new TextBlock();
textBlock2.Name = "textBlock2";
textBlock2.Height = 23;
textBlock2.HorizontalAlignment = HorizontalAlignment.Right;
textBlock2.Margin = new Thickness(0, 45, 70, 0);
textBlock2.Text = "Test textBlock 2";
}
}
}
<Page
x:Class="App2.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App2"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid x:Name="layoutGrid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="TEST"
Grid.Row="1"
Grid.Column="1"
Height="23"
HorizontalAlignment="Right"
Margin="0,45,70,0"
x:Name="Test TextBlock"/>
</Grid>
</Page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment