tags:

views:

67

answers:

1

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" />
        <ComboBoxItem 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>

A: 

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.

J Rothe