我有一個如下代碼片段。我想單擊測試按鈕來顯示擴展器,並讓擴展器覆蓋同一行中的TextBlock和ComboBox。我試過某人的解決方案來設置ZIndex,但不起作用。任何人都可以幫忙如何覆蓋擴展到另一個控件wpf
<Window.Resources>
<Storyboard x:Key="show" TargetProperty="Height">
<DoubleAnimation Storyboard.TargetName="TestRec" Duration="0:0:0.3" From="0" To="300"/>
</Storyboard>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Content="showRectangle" Click="Button_Click"/>
<TextBlock Text="Test TextBlock" Grid.Row="1"/>
<ComboBox Grid.Column="1" Grid.Row="1" SelectedIndex="0">
<ComboBoxItem Content="A"/>
<ComboBoxItem Content="B"/>
<ComboBoxItem Content="C"/>
<ComboBoxItem Content="D"/>
</ComboBox>
<Grid Grid.Row="1" Grid.ColumnSpan="2" x:Name="TestRec" Height="0">
<Expander Header="abc" IsExpanded="True">
<Expander.Content>
<ListView ItemsSource="{Binding List}">
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Expander.Content>
</Expander>
</Grid>
</Grid>
private void Button_Click(object sender, RoutedEventArgs e)
{
this.BeginStoryboard(FindResource("show") as Storyboard);
}
單擊按鈕會發生什麼? –
@OscarPaz擴展器內容和組合框內容混合 – James