我有一个充满少量条目的组合框,但其中一些组合框之间有相当多的空白。
即使在更改字体大小后,此空间仍然可见。 以下是XAML代码:
<ComboBox Grid.Row="1" Grid.Column="3" DisplayMemberPath="[ColumnName]" FontSize="18" HorizontalAlignment="Left" ItemsSource="{Binding Path=[TableName], NotifyOnSourceUpdated=True}" Width="250"/>ColumnName和TableName来自我的SQL表中。
在视图模型中,我有这样的代码:
PropertyInViewModel = DataModel.TableName.ToList();我的视图模型中的属性是这样的:
private IEnumerable<TableName> _propertyInViewModel; public IEnumerable<TableName> ProptertyInViewModel { get { return _propertyInViewModel; } set { _propertyInViewModel= value; this.RaisePropertyChanged(); } }我在这个表中有另一列,它只是上图中条目的主键。 如果我显示主键,我没有额外的空间。 我不确定问题是什么,但改变字体大小和组合框的宽度似乎不能解决问题。 任何帮助将是伟大的!
I have a combobox that is filled with a handful of entries, but some of them have quite a bit of whitespace between them.
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!
最满意答案
你的XAML没有任何问题。
确保源集合不包含ColumnName属性返回空string或null任何记录
还要确保其他记录不包含任何空行。
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.
更多推荐
发布评论