Monday, 9 September 2013

QT spacer equivalent in WPF

QT spacer equivalent in WPF

I have a StackPanel with some vertically alligned controls (stackpanel on
the right in this picture:
The last control should always be placed at the bottom of the window
inside of the border control (The OK button on the picture). In QT I'd
insert a spacer control to push the button down. How do I do that in WPF?
Thank you. Here is the xaml:
<Window x:Class="Test.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">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="354*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Margin="5" Background="Gray" CornerRadius="6" BorderBrush="Gray">
<Viewport3D Grid.Column="0" Name="viewport" ClipToBounds="True">
</Viewport3D>
</Border>
<Border Grid.Column="1" CornerRadius="6" BorderBrush="Gray"
Background="LightGray" BorderThickness="1" Margin="5"
HorizontalAlignment="Left" Name="border1" VerticalAlignment="Stretch"
>
<StackPanel>
<StackPanel Orientation="Horizontal">
<Label Content="Dimension" Name="label1"
VerticalAlignment="Center" />
<ComboBox Text="3D" HorizontalAlignment="Right"
Name="dimensioncb" VerticalAlignment="Center" IsReadOnly="True"
IsEditable="True">
<ComboBoxItem>2D</ComboBoxItem>
<ComboBoxItem>3D</ComboBoxItem>
</ComboBox>
</StackPanel>
<Separator/>
<DockPanel>
<Label Content="Iteration" Name="label2"
VerticalAlignment="Center" />
<ComboBox Text="3" HorizontalAlignment="Right"
Name="iterationcb" VerticalAlignment="Center" IsReadOnly="True"
IsEditable="True">
<ComboBoxItem>1</ComboBoxItem>
<ComboBoxItem>2</ComboBoxItem>
<ComboBoxItem>3</ComboBoxItem>
<ComboBoxItem>4</ComboBoxItem>
<ComboBoxItem>5</ComboBoxItem>
<ComboBoxItem>6</ComboBoxItem>
<ComboBoxItem>7</ComboBoxItem>
<ComboBoxItem>8</ComboBoxItem>
</ComboBox>
</DockPanel>
<Button Content="OK" VerticalAlignment="Bottom"/>
</StackPanel>
</Border>
</Grid>
</Window>

No comments:

Post a Comment