views:

32

answers:

1

Hi,

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

A: 

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>
Wonko the Sane
No. As per my above code, the combox height will be expanded when it gets focus also the combobox items list will be opened by default. But I want the combo list items also to be expanded as like combo box. I think my initial will give you more information.
ksvimal
To make sure I'm clear...When the ComboBox gets focus, you want it to grow in size (height), and the items to automatically be displayed as well. These items should also be twice their "normal" height. Could you edit your original question to show an instance of your ComboBox, as well as any event handlers you may have on it?
Wonko the Sane
Yes, you are right. As the style is created without any key it should be applicable for all the ComboBox placed inside the window. It just a normal ComboBox instance without any extra properties or event handlers.
ksvimal