C#WPF ComboBox-排除绑定数据的最后一行(或空白)(从Microsoft Access绑定) [英] C# WPF ComboBox - Exclude last row (or Blank Space) of Binding Data (binding from Microsoft Access)

查看:155
本文介绍了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') "; 

我遇到的问题是组合框显示了空白.我可以知道如何删除它吗?是通过访问查询还是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 ="False" 在您的组合框上.

Try setting ScrollViewer.CanContentScroll="False" on your ComboBox.

这篇关于C#WPF ComboBox-排除绑定数据的最后一行(或空白)(从Microsoft Access绑定)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆