问题标签 [listboxitems]

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 回答
43 浏览

c# - 仅保存已编辑的列表框条目

如果我在列表框中有一些现有条目。当我单击编辑按钮时,我将能够编辑这些条目。在再次单击按钮时编辑一个或多个条目后,我只想保存那些已编辑的条目。我怎么能这样做?请提出一些解决方案。

0 投票
1 回答
1614 浏览

c# - WPF ListboxItems Cosume too much memory

Ok i have an WPF application in wich i create my own ListBoxItem in a resource dictionary that looks like this :

A ListBox like this :

And i populate my ListBox items when the user chooses an Genre of the station, with a method like this :

Note : Every StationGenre will populate my ListBox with at least 1000 StationItems.

My code works fine and starts with a memory of 40MB (Window Task Manager). But whenever i select a genre and populate my ListBox, memory explodes at 100MB.And i then select another genre memory explodes further. I thought that with ListBox.Items.Clear(); the ListBoxItems will be destroyed from memory too, but this doesnt happen.

I tried to remove the image from my ListoBoxItemTemplate and checked my app's memory, but didnt see a real difference (About 4-7 MB's difference).

So my answer is : How can i make my application consume a lot less memory when adding items in the ListBox?

Thanks in advance!!

0 投票
1 回答
11226 浏览

c# - c# wpf - 不能同时设置 DisplayMemberPath 和 ItemTemplate

我想在 listboxItem 中添加工具提示,但是当有 DisplayMemberPath 时它开始出现问题。错误信息说:不能同时设置 DisplayMemberPath 和 ItemTemplate。当我删除 DisplayMemberPath 时,每个列表项中的工具提示都在工作。但我不想删除 DisplayMemember,因为我需要它。如何解决这个问题呢?

0 投票
1 回答
2496 浏览

asp.net - 从数据库中获取数据并将其用作列表框的项目。(ASP.NET)

我是 ASP.NET 的新手,我不知道如何使用列表框。我正在尝试从我的数据库中获取数据以将其用作我的列表框的项目。有人告诉我最好在我的情况下使用列表视图,但我也不知道该怎么做。我尝试在 youtube 上观看教程课程并在 google 上搜索它,但它对我没有帮助。

我的目标是 ff: - 在他/她的个人资料上显示用户的数据。- 让用户能够在列表框中选择多个项目。- 更新要在用户的个人资料上显示的个人资料和选择的项目。

我已经尝试这样做了一个星期。所以,非常感谢任何能帮助我的人。

这是我的 aspx cs 代码:

这是我的 aspx 代码:

0 投票
1 回答
135 浏览

c# - Finding Listbox Index of ListBoxItem (ItemsTemplate to specify Visual COntent)

How do you find the index of a ListBoxItem if it is set within a DataTemplate as a Textbox control? Here is the WPF:

When I gain focus of the textbox (text is bound to an observableCollection), I cannot simply use the SelectionChanged Event on the ListBox. I would like to know how I can determine the index of the textbox I have gained focus in.

Thanks

0 投票
4 回答
74402 浏览

c# - WPF/C# 将自定义对象列表数据绑定到 ListBox?

ListBox在将自定义对象列表的数据绑定到WPF 中时,我遇到了一些困难。

这是自定义对象:

这是列表:

当文件移动、删除、重命名等时,列表会被填充和维护FileSystemWatcher。列表所做的只是跟踪名称和路径。

这是我在 MainWindow 代码隐藏文件中的内容(现在为了测试目的而进行了硬编码):

这是我的 XAML 部分:

不幸的是,唯一显示的是MyApp.FileItem每个条目。如何显示名称等特定属性?

0 投票
2 回答
812 浏览

c# - 为什么当我调用 ListBox.SelectedValue 并在 C# 中按 ASC 顺序选择项目时,我总是从 ListBox 中获取第一个选定值?

我试图按它们被选中的顺序获取选中的项目,当我按 ASC 顺序选择项目时出现问题,我的意思是从上到下,它总是返回第一个 selectedIndex 或值,问题是可以按任何顺序选择项目。ListBox 控件的 SelectionMode 设置为 MultiSimple,我尝试使用 MultiExtended 没有成功。奇怪的是,当我从底部到顶部以相反的顺序选择项目时,它工作得很好。到目前为止,我一直在到处测试、阅读和搜索,但没有让它工作。ListBox 绑定到一个数据源。

直接使用集合是可以的,因为它返回 selectedItems,但我无法按照它们被选中的顺序获取项目。

0 投票
1 回答
351 浏览

visual-c++ - Visual C++ 2008 Express,列表框:访问项

我正在使用 VC++ 2008 Express,我希望能够访问列表框的项目,以便通过代码操作各种项目的光学方面。

首先,我写道:

编译器不接受这一点。

错误 C2039:“set”:不是“System::Windows::Forms::ListBox::AllowSelection”的成员

是评论。

我需要做什么?

解决错误,如何访问代码选择的项目以更改光学方面(前景色、背景色、字体...)?

谢谢并恭祝安康

乌韦

0 投票
1 回答
780 浏览

arrays - 如何将字符串数组与 ListBox 项进行比较?

我有

ListBox 包含的项目为

1.产品 2.物品 3.事物

我想将字符串从部件匹配到 ListBox 中的项目。如果匹配,我想在 ListBox 中选择该项目。
如何做到这一点?请帮帮我

0 投票
1 回答
722 浏览

windows-phone-8 - windows phone 8中DataTrigger的替代品是什么

我正在使用windows phone 8,我想在我的ListBox控件中设置不同的2个组件的样式,所以在谷歌搜索之后我知道可以通过DataTriggers,我正在我的应用程序中尝试做同样的事情,但它显示拼写错误在我的应用程序中。那么 Windows phone 8 中的 DataTrigger 有什么替代品吗?

如果它可以解决,请帮助我,它会打开很多方法来在我的应用程序中实现动态功能。