tags:

views:

1103

answers:

1

I have a ComboBox which I managed to keep its DropDown open after LostFocus. It's populated with a number of CheckBoxes. Whenever the user toggles one of these CheckBoxes, the whole application is updated by calling a DataService. During this time I'm blocking further user input using a transparent overlay rectangle (on top of the whole Silverlight content) with a wait cursor.

I tried increasing the Canvas.ZIndex of that Rectangle to get it on top of everything. But the open DropDown of my ComboBox is always on top of it.

A very much simplified example shows what I mean:

<UserControl x:Class="ComboDropDownTest.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
Width="400" Height="300">
<Grid x:Name="LayoutRoot" Background="White">
<ComboBox Canvas.ZIndex="0" Height="40" VerticalAlignment="Top">
    <ComboBoxItem Content="ComboBoxItem1"/>
    <ComboBoxItem Content="ComboBoxItem2"/>
    <ComboBoxItem Content="ComboBoxItem3"/>
    <ComboBoxItem Content="ComboBoxItem4"/>
</ComboBox>
<Button Canvas.ZIndex="9999" Height="55" Margin="18,66,19,0" VerticalAlignment="Top" Content="Button"/>
</Grid>

When the ComboBox is open, the DropDown covers the Button ignoring the ZIndex order.

+2  A: 

The reason this happens is that the dropdown is generated with a Popup (which always shows over everything else by its very nature). The only way I can imagine changing this is to modify the ComboBox's ControlTemplate to change the container for the dropdown. I didn't test it, but I would bet its the right solution.

Shawn Wildermuth