Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expand the combobox and its items when it gets focus

I want to expand the height of the combobox whenever the combobox gets the Focus.

I have used the following code to expand the combobox height.

<Style TargetType="{x:Type ComboBox}">    
<Style.Triggers>    
    <Trigger Property="IsKeyboardFocusWithin" Value="True">    
        <Setter Property="RenderTransform">   
            <Setter.Value>   
                <ScaleTransform ScaleX="1" ScaleY="2" />   
            </Setter.Value>   
        </Setter>   
        <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>    
        <Setter Property="Panel.ZIndex" Value="99999"/>    
    </Trigger>    
</Style.Triggers>  
</Style>

Problem:

When i put the focus on the Combobox first time, the combobox item list opened in normal mode. But if i again click on the combobox then combobx item list opened and also list items height is expanded.

But i want the combobox list items to be expanded even in the first click (focus) also. Also combobox height must be in expanded mode even when i select the item in the Combobox item.

Thanks in advance

like image 461
ksvimal Avatar asked Sep 08 '10 11:09

ksvimal


1 Answers

Is this what you want?

        <Style TargetType="{x:Type ComboBox}">
            <Style.Triggers>
                <Trigger Property="IsKeyboardFocusWithin" Value="True">
                    <Setter Property="IsDropDownOpen" Value="true" />
                </Trigger>
            </Style.Triggers>
        </Style>
    </ComboBox.Style>
like image 135
Wonko the Sane Avatar answered Oct 19 '22 16:10

Wonko the Sane