SQL and Java Learner
SQL and Java Learner

Reputation: 731

WPF combobox extra space between entries

I have a combobox that is filled with a handful of entries, but some of them have quite a bit of whitespace between them.

enter image description here

This space is still visible even after I change the font size. Below is the XAML code:

<ComboBox Grid.Row="1" Grid.Column="3" DisplayMemberPath="[ColumnName]" 
 FontSize="18" HorizontalAlignment="Left" 
ItemsSource="{Binding Path=[TableName], NotifyOnSourceUpdated=True}" Width="250"/>

where ColumnName and TableName come from my table in SQL.

In the view model I have this code:

PropertyInViewModel = DataModel.TableName.ToList();

where my property in my view model is this:

private IEnumerable<TableName> _propertyInViewModel;
public IEnumerable<TableName> ProptertyInViewModel
{
    get { return _propertyInViewModel; }
    set { _propertyInViewModel= value; this.RaisePropertyChanged(); }
}

I have another column in this table that is simply a primary key for the entries in the picture above. If I display the primary keys, I don't have the extra space. I'm not sure what the issue is, but changing the font size and the combobox's width did not seem to fix the issue. Any help would be great!

Upvotes: 0

Views: 255

Answers (1)

mm8
mm8

Reputation: 169160

There is nothing wrong with your XAML.

Make sure that the source collection doesn't include any records where the ColumnName property returns an empty string or null

Also make sure that the other records don't include any empty lines.

Upvotes: 1

Related Questions