任何人都可以帮我解决我的问题吗?当此视图加载时,扩展器会扩展但在内容内部,网格不会向左对齐。我已经尽了一切可能的想法。任何帮助将不胜感激。
<Expander Background="White" FlowDirection="RightToLeft" Header="Test" BorderBrush="Black" BorderThickness="1" Margin="5">
<Expander.Content>
<Label Background="Orange" Margin="5" HorizontalContentAlignment="Left">
<Grid FlowDirection="LeftToRight" Width="816" HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="25"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<CheckBox Name="chkTest" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="15,0,0,0" Content="Test"/>
<TextBox Name="txtBlah" Grid.Row="0" Grid.Column="1" Text="Blah" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="10,0,0,0" />
<CheckBox Name="chkTest2" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="15,0,0,0" Content="Test2"/>
<TextBox Name="txtBlahBlah" Grid.Row="0" Grid.Column="3" Text="BlahBlah" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="10,0,0,0" />
<TextBlock Name="txtBlockTest3" Grid.Row="0" Grid.Column="4" Text="Test3" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="15,0,0,0"/>
<TextBox Name="txtTest4" Grid.Row="0" Grid.Column="5" Text="Test4" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5,0,0,0" />
<TextBlock Name="txtBlockTest5" Grid.Row="0" Grid.Column="6" Text="Test5" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="15,0,0,0"/>
<ComboBox Name="cbTest6" Grid.Row="0" Grid.Column="7" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5,0,0,0"/>
</Grid>
</Label>
</Expander.Content>
</Expander>
答案 0 :(得分:1)
将FlowDirection="LeftToRight"
从Grid
移至Label
即可完成工作。
<Label FlowDirection="LeftToRight" Background="Orange" Margin="5">
<Grid Width="816" HorizontalAlignment="Left">