我需要把分組控制,並通過邊把他們一邊。我想出了這個代碼使用多個StackPanel
來做到這一點。把堆棧面板並排
<Window x:Class="xamlTests.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="310" Width="525">
<Grid>
<StackPanel x:Name="_ribbonRadioButtonPanel" Orientation="Vertical">
<CheckBox Content="Signed" Height="16" Name="Signed" Checked="Signed_Checked" Margin="10,5"/>
<StackPanel x:Name="_wordLength" Orientation="Horizontal">
<TextBox Height="18" Name="textBoxWordLength" Width="30" Margin="10,5"/>
<TextBlock Height="20" Name="textBlockWordLength" Text="Word Length" Width="120"/>
</StackPanel>
<StackPanel x:Name="_integerWordLength" Orientation="Horizontal">
<TextBox Height="18" Name="textBoxIntegerWordLength" Width="30" Margin="10,5"/>
<TextBlock Height="20" Name="textBlockIntegerWordLength" Text="Integer Word Length" Width="120"/>
</StackPanel>
</StackPanel>
<StackPanel x:Name="_ribbonRadioButtonPanel2">
<StackPanel x:Name="_max" Orientation="Horizontal">
<TextBox Height="18" Name="maxTextBox" Width="100" Margin="10,5"/>
<TextBlock Height="20" Name="maxTextBlock" Text="Max" Width="120"/>
</StackPanel>
<StackPanel x:Name="_min" Orientation="Horizontal">
<TextBox Height="18" Name="minTextBox" Width="100" Margin="10,5"/>
<TextBlock Height="20" Name="minTextBlock" Text="Min" Width="120"/>
</StackPanel>
<StackPanel x:Name="_delta" Orientation="Horizontal">
<TextBox Height="18" Name="deltaTextBox" Width="100" Margin="10,5"/>
<TextBlock Height="20" Name="delatTextBlock" Text="Delta" Width="120"/>
</StackPanel>
</StackPanel>
</Grid>
</Window>
但是,我得到StackPanels超頻。 XAML有什麼問題?什麼佈局面板用於對齊多個組件?
您正在使用網格來同時存放兩個堆疊面板....在網格中使用堆疊面板或..使用網格排列來對齊它們 – Bathineni