C# WPF ComboBox - 排除绑定数据的最后一行(或空格)(从 Microsoft Access 绑定) [英] C# WPF ComboBox - Exclude last row (or Blank Space) of Binding Data (binding from Microsoft Access)
本文介绍了C# WPF ComboBox - 排除绑定数据的最后一行(或空格)(从 Microsoft Access 绑定)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目前我使用 Microsoft Access 来保存数据,它将绑定到 WPF 组合框.下面的代码几乎可以正常工作.
Currently I am using Microsoft Access to keep the data and it will bind to WPF combobox. Below code was working almost fine.
oleDBCommand.CommandText =
"SELECT "
+ "table.[Col1] & ' - ' & table.[Col2] As COl1_Col2, table.[Col3] " +
"FROM "
+ "table_1 " +
"WHERE "
+ "(table_1.[col3] = '" + comboboxSelection.Text + "' OR table.[col3] = 'All') ";
我遇到的问题是组合框显示空白.我可以知道如何删除它吗?是通过 Access Query 还是 ComboBox 属性?
The problem that I have is the combobox shows empty space in it. May I know how to remove it? Is it through Access Query or ComboBox Property?
推荐答案
尝试设置ScrollViewer.CanContentScroll="假"在您的 ComboBox 上.
Try setting ScrollViewer.CanContentScroll="False" on your ComboBox.
这篇关于C# WPF ComboBox - 排除绑定数据的最后一行(或空格)(从 Microsoft Access 绑定)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文