Skip to content

Instantly share code, notes, and snippets.

@droyad
Created July 3, 2012 01:27
Show Gist options
  • Save droyad/3036897 to your computer and use it in GitHub Desktop.
Save droyad/3036897 to your computer and use it in GitHub Desktop.
<Window x:Class="WpfApplication2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<!-- These can go into the global styles-->
<Style TargetType="{x:Type Label}">
<Setter Property="TextBlock.TextAlignment" Value="Right" />
<Setter Property="Margin" Value="5,5,10,5" />
<Setter Property="Height" Value="30" />
</Style>
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}" >
<Setter Property="Margin" Value="5,5,10,5" />
<Setter Property="Height" Value="30" />
</Style>
</Window.Resources>
<Grid>
<Grid.Resources>
<Style x:Key="RightAlignTextBox" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}" >
<Setter Property="TextBlock.TextAlignment" Value="Right" />
</Style>
</Grid.Resources>
<DockPanel LastChildFill="True">
<StackPanel>
<Label Content="Text" />
<Label Content="Text" />
<Label Content="Text Text" />
<Label Content="Text" />
</StackPanel>
<StackPanel>
<TextBox Text="Blah" />
<TextBox Text="Blah" />
<TextBox Text="Blah" />
<TextBox Text="Blah" />
</StackPanel>
</DockPanel>
</Grid>
</Window>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment