我的问题是可见的图像“wrong.png” 我已经创建了一个应该有3列,并停靠在底部的堆叠面板,以及它的内容,在这案件是3个按钮。看着“wrong.png”,这对我来说并不好。停靠在底部的堆栈面板,并添加列定义
我已经添加了另一个图像“desired.png”,它显示了我想实现的目标。 感谢您提供任何帮助。
这里是代码:
<Window x:Class="EnerMedit.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="499.88" Width="702">
<DockPanel LastChildFill="True">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Label Content="Seavaro" Grid.Row="0" FontSize="18" />
<Label Content="Date" Grid.Row="1" />
<DatePicker Grid.Row="2" Name="datepicker" Background="Honeydew" />
<Label Content="Note:" FontWeight="ExtraBold" Grid.Row="3" Margin="0 10 0 0" />
<RadioButton Content="Meditation" Name="mediNote" Margin="50 17 0 0" Grid.Row="3" />
<RadioButton Content="Energy" Name="energyNote" Margin="150 17 0 0" Grid.Row="3" />
<RadioButton Content="Both" Name="bothNoteButton" Margin="250 17 0 0" Grid.Row="3" Checked="bothNoteButton_Checked" />
<TextBox Grid.Row="4" Background="Honeydew" />
<Separator Width="auto" Grid.Row="5" Margin="0 20 0 20" Background="GreenYellow"/>
<TextBox Grid.Row="6" MinHeight="150" TextWrapping="Wrap" Background="Honeydew" IsReadOnly="True" />
<CheckBox Content="Done" Name="doneCheck" Grid.Row="7" Margin="5 7 0 0" />
<Label Content="Akana" Grid.Column="1" Grid.Row="0" FontSize="18" Margin="10 0 0 0" />
<CheckBox Content="Check all" Grid.Column="1" Grid.Row="1" Margin="200 7 0 0" Name="IsCheckedCheckAll"
Checked="IsCheckedCheckAll_Checked" Unchecked="IsCheckedCheckAll_Checked" />
<Label Content="Excercise 1" Grid.Column="1" Grid.Row="2" FontFamily="Comic Sans MS" Margin="10 0 0 0" />
<CheckBox Name="Exc1" Grid.Column="1" Grid.Row="2" Margin="200 7 0 0" IsChecked="{Binding IsChecked, ElementName=IsCheckedCheckAll, Mode=OneWay}" />
<Label Content="Excercise 2" Grid.Column="1" Grid.Row="3" FontFamily="Comic Sans MS" Margin="10 0 0 0" />
<CheckBox Name="Exc2" Grid.Column="1" Grid.Row="3" Margin="200 7 0 0" IsChecked="{Binding IsChecked, ElementName=IsCheckedCheckAll, Mode=OneWay}" />
<Label Content="Excercise 3" Grid.Column="1" Grid.Row="4" FontFamily="Comic Sans MS" Margin="10 0 0 0" />
<CheckBox Name="Exc3" Grid.Column="1" Grid.Row="4" Margin="200 7 0 0" IsChecked="{Binding IsChecked, ElementName=IsCheckedCheckAll, Mode=OneWay}" />
<Label Content="Excercise 4" Grid.Column="1" Grid.Row="5" FontFamily="Comic Sans MS" Margin="10 0 0 0" />
<CheckBox Name="Exc4" Grid.Column="1" Grid.Row="5" Margin="200 7 0 0" IsChecked="{Binding IsChecked, ElementName=IsCheckedCheckAll, Mode=OneWay}" />
<Label Content="Excercise 5" Grid.Column="1" Grid.Row="6" FontFamily="Comic Sans MS" Margin="10 0 0 0" />
<CheckBox Name="Exc5" Grid.Column="1" Grid.Row="6" Margin="200 07 0 0" IsChecked="{Binding IsChecked, ElementName=IsCheckedCheckAll, Mode=OneWay}" />
</Grid>
<StackPanel VerticalAlignment="Bottom">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Content="Add" Name="SubmitButton" Grid.Column="0" Height="23" IsEnabled="{Binding ElementName=doneCheck, Path=IsChecked}" />
<Button Content="Labaci recardo" Name="GetMedButton" Grid.Column="1" Grid.Row="9" />
<Button Content="Supa recardo" Name="GetEnegButton" Grid.Column="2" />
</Grid>
</StackPanel>
</DockPanel>
尝试将您的'StackPanel'放在更高一层。 – AgentFire 2014-09-21 11:01:06
在我将它移出之前,我曾尝试过。按钮仍然浮动在顶部,但是这次在右侧,并且将只有两列,因为在该级别上已经有另一个列定义了。 – user1960836 2014-09-21 11:06:54