WPF: Making things appear above expanded combobox
Is there any way to make something appear above the popup part of a combobox?
Panel.ZIndex doesn't seem to help - the popup part is always displayed above everything else!
As an example, if you use the following code, is there any way to make the textblock appear above the popup part of the combobox when it is expanded?
<Window x:Class="Zindex.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Zindex" Height="350" Width="525">
<Grid Name="LayoutRoot" ShowGridLines="True">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<ComboBox Width="100" Height="24" Grid.Row="0" VerticalAlignment="Bottom">
<ComboBoxItem Content="A" />
<ComboBoxItem Content="B" />
<ComboBoxItem Content="C" />
<Co开发者_如何学编程mboBoxItem Content="D" />
</ComboBox>
<TextBlock Grid.Row="1" Width="300" TextWrapping="Wrap">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed volutpat faucibus
luctus. Morbi at semper massa. Mauris bibendum, eros in aliquam ultrices, odio
purus dignissim sapien, non eleifend leo mi in nulla. Sed risus urna,
fringilla vitae pulvinar interdum, consectetur ac sapien. Pellentesque turpis
ante, pulvinar quis adipiscing ac, rutrum at purus. Integer ultricies pulvinar
consequat.
</TextBlock>
</Grid>
You need to use an adorner layer. Those render above everything and can be configured to render relative to a control or to the window as a whole.
精彩评论