listbox

Displaying a large number of strings in WinForms listbox/listview controls

守給你的承諾、 提交于 2020-01-05 08:33:30
问题 My WinForms UI contains a tab control with two tab pages. On one tab, I need to display a list of up to 100,000 strings in a manner that allows my users to add, edit and delete strings in the list. On the second tab, I need to display a "read-only" copy of the strings from the first tab. I also need controls on the second tab that allow the user to copy strings from the "read-only" list into a second unrelated list. I currently have the 100k strings in an array and my first thought was to use

Changing ListBox SelectedValuePath throws an exception

落花浮王杯 提交于 2020-01-05 07:54:43
问题 I wrote a quick application for an article on CodeProject (full article here. You can download the source code for this question directly from here). It's a very simple window that has a ListBox with simple objects (3 properties: 2 strings, 1 int). public class MyShape { public string ShapeType { get; set; } public string ShapeColor { get; set; } public int ShapeSides { get; set; } } I'm setting the SelectedValuePath in the code behind so a user can select a property from a combobox, and see

DataTemplate for ListBox element is not binding at all

ε祈祈猫儿з 提交于 2020-01-05 07:31:15
问题 I have a ListBox element, which purpose is to show the users the activities, that are registered on the Database so that they can choose from them to modify or delete them. After consulting two very useful answers about using DataContext and DataTemplates, I decided to implement that knowledge in my project, unfortunately, it's not working. When I run it and I select the text on the ListBox , I only see: DataTemplate templ = new DataTemplate(typeof(Activities)); as its content, and I didn't

Reference List Box Column by Field Name

。_饼干妹妹 提交于 2020-01-05 05:55:34
问题 I have an MS Access form in which selection of a list box item determines how many other aspects of the application behave. I have a table containing an ID and description and several other fields which correspond to settings for other aspects of the application; this table is the Row Source of the list box. The list box is configured such that the first two columns (ID & Description) are visible, with the widths of the remaining columns set to 0 - the Column Widths property of the list box

Listbox bindind error scrolling

会有一股神秘感。 提交于 2020-01-05 04:41:07
问题 I have a listbox(JumpListBox) with ~500 items. Listbox template is a grid which have two columns - checkbox and image; To reproduce problem: I've checked two items, then I do scrolling, then I can see that checkbox not corresponding to item which was selected. When I do scrolling back to the item I was selected I see that items are not selected, but other items was selected. I recorded a video and you can see a problem. 来源: https://stackoverflow.com/questions/12026890/listbox-bindind-error

Styling a ListBoxItem depending on its index in the ListBox

跟風遠走 提交于 2020-01-04 15:15:21
问题 I want to change the margin of the first item in the ListBox if SomeProperty value is 10, without code-behind. This is what I have so far: <ListBox x:Class="Windows.CustomList" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Windows" mc:Ignorable="d" x:Name="MyList

How to force ListBox to reload properties of ListBoxItems

隐身守侯 提交于 2020-01-04 13:45:56
问题 Is there any way, how to force ObservableCollection to fire CollectionChanged? I have a ObservableCollection of objects ListBox item source, so every time I add/remove item to collection, ListBox changes accordingly, but when I change properties of some objects in collection, ListBox still renders the old values. Even if I do modify some properties and then add/remove object to the collection, nothing happens, I still see old values. Is there any other way around to do this? I found interface

Strange behaviour with a lot of data in ListBox and Checkbox [minimal project provided]

孤人 提交于 2020-01-04 13:43:34
问题 For that problem I made a minimal project for everyone to experience this behaviour. I hope it is not just on my engine running like this. minimal project In my project I realized a listbox with a a lot of sample data. The listbox has a checkbox element for each item as well. The problem: First I check/uncheck checkboxes in my listbox. Then I scroll several times through my listbox. Now I notice that a lot of checkboxes get checked/unchecked randomly. If I cut the ListBox a bit down (see

Strange behaviour with a lot of data in ListBox and Checkbox [minimal project provided]

那年仲夏 提交于 2020-01-04 13:43:31
问题 For that problem I made a minimal project for everyone to experience this behaviour. I hope it is not just on my engine running like this. minimal project In my project I realized a listbox with a a lot of sample data. The listbox has a checkbox element for each item as well. The problem: First I check/uncheck checkboxes in my listbox. Then I scroll several times through my listbox. Now I notice that a lot of checkboxes get checked/unchecked randomly. If I cut the ListBox a bit down (see

Get SelectedItems from database fed ListBox

▼魔方 西西 提交于 2020-01-04 13:11:55
问题 I need to get values from selected items from listbox which is binding from database. But if I try listBoxAtribute.SelectedItems[0].ToString() it returns System.Data.DataRowView Is there any way to convert Data from DataRowView to string ? My idea looks like this: for(int i = 0; i < listBoxAtribute.SelectedItems.Count; i++) { MessageBox.Show(listBoxAtribute.SelectedItems[i].Tostring); } Thanks a lot for any reply. 回答1: Try casting selected item of listbox to DataRowItem first and access