WPF ComboBox with editable text field as element

I want to have a combo box with only two elements:

-----------
|  Other.. |
------------
|  TextBox |
------------

A text field representing a physical text field that can be edited Other..is just a regular list item.

Can someone help me on how I need to edit it.

I tried changing the Combbox.itemtemplate with the stack panel, and then adding a text box, but it didn’t appear, and this also prevents me from having a regular list item in the control.

Thanks in advance.

+5
source share
2 answers

Not quite sure what the problem is, you tried this:

<ComboBox>
    <ComboBoxItem>Other</ComboBoxItem>
    <TextBox>TextBox</TextBox>
</ComboBox>

, , , ...


( TextBox , , )

<ComboBox>
    <ComboBoxItem>Normal Item</ComboBoxItem>
    <StackPanel Orientation="Horizontal">
        <TextBlock Text="Other: " VerticalAlignment="Center"/>
        <TextBox>Enter text...</TextBox>
    </StackPanel>
</ComboBox>
+2

ComboBox.IsEditable = true? ComboBox.Text.

+12

All Articles