问题标签 [listbox]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
612 浏览

c# - 当我在列表框中移动时,为什么我的选中项变为未选中?

下面的代码将列表框中的选定项目向下移动到列表框中的下一个项目,但如果选中了它,它将取消选中选定的项目。我怎样才能防止这种情况?

谢谢

moveListboxItem 的代码如下:

0 投票
2 回答
11129 浏览

wpf - ListBox.SelectedItems 的双向手动绑定实现?

我一直在尝试查看是否有一种简单/聪明的方法来实现与 ListBox.SelectedItems 的绑定。如果您自己尝试过,您就会知道,使用 BindingExtension 的标记绑定将不起作用——该属性不支持它。因此,您需要为 SelectionChanged 连接一个处理程序并尝试该路线。我得到的最接近的是这篇文章:

http://alexshed.spaces.live.com/blog/cns!71C72270309CE838!149.entry

更新:上面提到的博客不再可用,该作者当前的博客在这里,我能找到的最接近引用的博客文章的是这个 StackOverflow 答案

它在一个方便的附加属性中实现了所有必要的 C#。但它将“绑定”实现为单向、目标到源。我想要双向绑定。

有任何想法吗?

0 投票
3 回答
2306 浏览

sql - 使用 SQL Server 过滤多选框

我需要根据多选列表框中的选择过滤来自 sql server 的结果集。我已经考虑过使用 instring 来确定所选过滤器值中是否存在行值,但这很容易出现部分匹配(例如 Car 匹配 Carpet)。

我还经历了将字符串拆分成一个表并基于此加入/匹配,但我对它的执行方式持保留态度。

鉴于这是一项看似常见的任务,我正在向 Stack Overflow 社区寻求一些反馈,并可能就解决此问题的最常用方法提出一些建议。

0 投票
5 回答
2365 浏览

c# - C#如何为列表框中的选定项目运行一些代码?

我有一个名称列表框,我想单击其中一个名称以使其突出显示,然后单击一个为所选项目运行一些代码的按钮。我如何调用这个选定的项目?

非常感谢

0 投票
3 回答
2304 浏览

c# - How to filter the following listboxes in asp.net?

I have 4 listboxes (lstStates, lstCounties, lstCities, and lstZipcodes). Here are a few constraints:

  • None of the listboxes are disabled.

  • Any listbox can be selected at anytime, meaning there is no specific order the user has to choose.

  • Filtering is forward and backwards. By this, I mean if a user selects a state from lstStates, it will filter lstCounties, lstCities, and lstZipcodes. If a user selects a zipcode from lstZipcodes, it will filter lstCities, lstCounties, and lstStates.

  • The listboxes allow multiple selections.

Each listbox is bound to a datatable to get its initial data. The datatable is retrieved from a sqlserver stored procedure. Each listbox has its own stored procedure, for example, lstStates has one called GetStates which returns one column (State) and the ListBoxes DataValueField and DataTextField are both set to State. Similar to lstStates, lstCities is bound to a datatable which gets one column from a GetCities stored proc which is city.

Another thing I want to point out is that I am connecting an ObjectDataSource to get the datatable.

0 投票
5 回答
4823 浏览

wpf - 如何在 ListBoxItem 中居中 WPF CheckBox

我有一个使用 ItemContainerStyle 的 ListBox。我已经尝试了所有我能想到的让 CheckBox 控件垂直和水平居中。有任何想法吗?

CheckBoxes 得到这种风格:

以下是可编辑/不可编辑的:

非常感谢所有试图帮助我解决这个问题的人!

0 投票
2 回答
1560 浏览

wpf - 如何将自定义值绑定到 ListBox DataTemplate 内 TextBlock 的 Text 属性?

我希望我的ListBox使用其索引 + 1对每个ListItem进行编号。

我将如何对ListBoxDataTemplate中的TextBlock的Text属性执行此操作?

0 投票
3 回答
294 浏览

linq - C# 从列表中排除相关值 (LINQ)

在 linQ to SQL中“加入”是否有完全相反的动作?我只想显示不满足查询内部连接约束的结果。我只想在一个查询中完成。这是它的使用示例(http://img165.imageshack.us/img165/4940/liststj3.jpg)。

0 投票
7 回答
6361 浏览

.net - WPF - 实现一个允许上下移动项目的列表框

这与我上一篇文章有​​关。

我想在列表框项目上有向上和向下按钮,以便它们可以向上/向下移动,即更改其在列表中的索引。

任何想法我将如何实际做到这一点?

马尔科姆

0 投票
2 回答
2112 浏览

winforms - 线程列表框 C# SharpDevelop

我正在尝试在简单的 winform 中使用线程。我有一个 ListBox,我想在表单的加载方法中填充数字。我不想等到它被填满。我正在使用这样的东西:

然后在 Load 方法中我这样做:

为什么它不起作用?

我收到此错误:预期方法名称(CS0149)

谢谢。