0

I have a WPF combobox (From the toolbox) that I'm trying to edit.

The created combobox can be filtered by clicking into it and typing what you want.

How does a combobox know (What event gets triggered or element get activated or ...) if your clicking on the arrow or the textbox.

Bonus: Using styles can you change the ratio of the combobox that you can click for the textbox vs the dropdown arrow?

Mandelbrotter
  • 2,216
  • 2
  • 11
  • 28
  • 2
    Not sure why this request was downvoted and closed -- it seems really specific and straightforward, and it even has a valid answer. – BrainSlugs83 Sep 05 '20 at 00:50
  • @BrainSlugs83 It asks 2 questions, one based on events, and one about display, which will be totally independent, and should be a separate post. You state it has a valid answer, and I don't care about that problem, I'm here for the original. – Adrian Harrison Apr 14 '22 at 14:21

1 Answers1

1

The default ComboBox has a default styling which determines the size of the text box and the drop down arrow. Like other controls in WPF, you can edit the control template of the ComboBoxto change the appearance and size of those items. If you look at this question you can see examples of overriding the default styling. What you are interested in is the size of the column definitions:

    <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="20" />
        </Grid.ColumnDefinitions>
Peter Boone
  • 1,193
  • 1
  • 12
  • 20