我在网格行中有扩展器控件。我在扩展器按钮上更改扩展器大小,单击以最大化扩展器大小。在折叠状态下,我将扩展器尺寸最小化。问题是扩展器在网格行下展开。有什么方法可以使扩展器在任何控件之上扩展?
<Grid AllowDrop="False">
<Grid.RowDefinitions>
<RowDefinition Height="199*" />
<RowDefinition Height="175*" />
</Grid.RowDefinitions>
<Grid Height="60" HorizontalAlignment="Left" Margin="21,26,0,0" Name="grid1" VerticalAlignment="Top" Width="550" Background="#FFE59E9E">
<Label Content="Label" Height="28" HorizontalAlignment="Left" Margin="62,113,0,0" Name="label1" VerticalAlignment="Top" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="130,115,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" Background="#FF2B1313" />
</Grid>
<Expander Name="exp" Expanded="exp_Expanded" Background="#FF3383A7" BorderThickness="4" BorderBrush="{x:Null}" FlowDirection="LeftToRight" Collapsed="exp_Collapsed" ExpandDirection="Left" Height="49" VerticalAlignment="Top" HorizontalAlignment="Right" Width="602" Margin="0,139,237,0">
<DataGrid AutoGenerateColumns="False" Height="105" Name="dataGrid1" Width="200" HorizontalContentAlignment="Center" VerticalAlignment="Center" />
</Expander>
</Grid>
private void exp_Expanded(object sender, RoutedEventArgs e)
{
var exp = (Expander) sender;
//grid1.Width = 550;
// grid1.Height = 40;
exp.Width = 602;
exp.Height = 300;
}
private void exp_Collapsed(object sender, RoutedEventArgs e)
{
var exp = (Expander)sender;
// grid1.Height = 500;
exp.Width = 602;
exp.Height = 49;
}