P
P
Pavel Kaptur2016-01-19 09:15:43
WPF
Pavel Kaptur, 2016-01-19 09:15:43

How to expand ComboBox to all available space?

Hi everyone, please advise. I'm drawing a window, and I want to make my status bar have a small ProgressBar on the left, two buttons on the right, and all the space between them was occupied by the ComboBox. those. i want it to look like this,
8181611ae33946208920713752b60b8e.PNG
but that's the only way i can do it,
f0f1a86943b84eec91722bb8cabadb04.PNG
and i can't figure out why the combobox is so small. I tried to use docpanel and grid, but even if you select the control in the Xaml code, it displays its sizes as the total size of all elements in the picture 2, and not as 1. Although the status bar really takes up all the free space.

<StatusBar DockPanel.Dock="Bottom" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
  <DockPanel Width="1004" Height="Auto" LastChildFill="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                <ProgressBar Name="ExecutionProgress" Height="Auto" Margin="3" MinWidth="200" MaxWidth="400" DockPanel.Dock="Left"></ProgressBar>
                <StackPanel Orientation="Horizontal" Height="Auto" DockPanel.Dock="Right">
                    <Button Name="SaveExecutionLog" Width="Auto" Height="Auto" Content="Save Log" Margin="2" Padding="4"></Button>
                    <Button Name="ClearExecutionLog" Width="Auto" Height="Auto" Content="Clear Log" Margin="2" Padding="4"></Button>
                </StackPanel>
                <ComboBox Name="ExecutionEvents" Height="Auto" Width="Auto" Margin="3">
                    <ComboBoxItem>jfjfjxdfvbdfhfghfghfghfghfghjfg[pjkhlp'fghfg]ophkfg]pkh]pfg]hkfg]pkh]pfghokfg]pkh]-fg</ComboBoxItem>
                </ComboBox>
  </DockPanel>
</StatusBar>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question