I am working on a WPF application following MVVM. I have two ComboBoxes in the application. One is binded to a list of intergers and other to list of string. The problem is height of comboboxes are different (see picture below). Any idea why heights are different? There is no styling involved on both comboboxes.
View:
<UserControl.Resources>
<Style TargetType="ComboBox" >
<Setter Property="Margin" Value="5" />
</Style>
<Style TargetType="TextBlock" >
<Setter Property="Margin" Value="5" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</UserControl.Resources>
...
<StackPanel>
<TextBlock Text="{x:Static p:Resources.OutputLayersAsText}" />
<ComboBox ItemsSource="{Binding StringCollection}" />
<TextBlock Text="{x:Static p:Resources.IgzStatAreaSizeText}" />
<ComboBox ItemsSource="{Binding IntegerCollection}" />
</StackPanel>
ViewModel:
private ObservableCollection<string> _stringCollection;
public ObservableCollection<string> Stringcollection => _stringCollection ?? (_stringCollection = new ObservableCollection<string>
{
".igz", ".png+.png", ".jpg+.png"
});
private ObservableCollection<int> _integerCollection;
public ObservableCollection<int> IntegerCollection => _integerCollection ?? (_integerCollection = new ObservableCollection<int>
{
8, 12, 16, 24, 32, 48, 64, 96, 128
});
I also tried another combobox with a collection of enums, and its height was similar with integer combobox height.