Following XAML, โMy stuffโ is in the center ComboBoxuntil I open ComboBoxwhen it stretches correctly.
<ComboBox Height="30" Width="300" HorizontalContentAlignment="Stretch" SelectedIndex="0">
<ComboBoxItem HorizontalContentAlignment="Stretch">
<Border Background="Red">
<TextBlock>My stuff...</TextBlock>
</Border>
</ComboBoxItem>
</ComboBox>
The question is, is it possible to stretch ComboBoxItemeven if it was selected with SelectedIndex? The same error or function occurs if SelectedIndex is untouched (-1), and one selects the item using the keyboard.
The workaround is probably to launch ComboBox programmatically at the beginning of the application, which is pretty ugly.
source
share