listbox

WPF - ListBoxItem selection with LeftClick only

I have a ListBox with SelectionMode="Multiple", which allows me to select multiple rows by clicking either the left or right mouse buttons. How can I restrict the selection to occur from the LEFT mouse button click only? ...

Listbox data

Now in my program in c# that simulates the working of a lan-messenger I need to show the people who are currently online with one remote host-name on each line. However the problem here is that in order to do that I am using the function //edited this line out, can't find a .Append for listBox or .AppendLine //listBox.Append(String ); ...

ASP.NET Display Selected Items from Listbox in Textbox

I'm trying to display all selected items from a listbox into a textbox. Currently I'm doing the following without success: For i As Integer = 0 To lb_words.ListCount If lb_words.Selected(i) = True Then tb_text.Text &= " Presto" End If Next What should be happening is that for every selected item in my listbox (lb.words...

Programmatically Search an Access Listbox control's Items Based Off of a Textbox Entry

I don't know if this is possible, but I am trying to code an Access textbox that will act as a search engine entry control for a database. Specifically, I wanted to add mulitple, non-visible, listboxes to a form, and have them filled with table or query data. When ever an end-user enters a search word in the textbox and presses search,...

Image thumbnail in a WinForms listbox

I am trying to display a thumbnail inside a listbox in a Windows Form application. I've read around and seen all sorts of suggestions, but I'm looking for the simplest one. Here's the details of what I'm trying to do. I am trying to display a thumbnail of an image AND display text next to it. I've looked at ListViews and they don...

Setting selected item in a ListBox without looping

Hi, I have a multi-select listbox which I am binding to a DataTable. DataTable contains 2 columns description and value. Here's the listbox populating code: DataTable copytable = null; copytable = GlobalTable.Copy(); // GlobalTable is a DataTable copytable.Rows[0][0] = "--ALL--"; copytab...

autoupdate a list in wpf

Hi, I want to display a bunch of Objects i have created in a ListBox. My objects implement the INotifyPropertyChanged Interface. I tried to use an ObservableCollection, which i have bound to a listbox Control (listbox1.DataContext = MyCollection) But this does not exactly what i want to do, because the Listbox is not refreshed when one o...

How to display a Dictionary in a ListBox

Hi I'm trying to display Key/Value Pairs from a Dictionary to a ListBox. Key Value A 10 B 20 C 30 I want to display them in a ListBox in following format A(10) B(20) C(30) Using following code I have been able to link Listbox.Datasource to Dictionary. myListBox.DataSource = new BindingSource(myDictionary, null); Its be...

Wrapping images in ListBox using WrapPanel and ScrollViewer, Selected Items disappear!!

I'm using a ListBox to display a horizontal display of 800 thumbnails, but only 6 at a time (depending on screen resolution), I want to move through the images using buttons either side of the list. I currently have this working, but when I change the SelectedItem of the listbox to next/previous thumbnail the ScrollViewer doesn't autom...

WPF: Bind Collection with Collection to a ListBox with groups

Hi, sometimes WPF is too complex for me. I've got my "Window1" holding a collection of "Group"s. "Group" is a class with a collection of "Person"s. In the end this should be a contact list. What I simply want to do is to show the groups with its person in a ListBox, where the group name of the list groups equals the Name Property of my ...

Making a collection of WPF Expanders 'expand' exclusively, i.e. only one expanded at a time.

I have a ListBox containing a group of 'Expander' items, and what I would like to do is make the 'IsExpanded' property for each of them exclusive - i.e. if I have 10 Expanders in the ListBox, I'd like only one to be open at a time... Soo at present I have: <Window> <Window.Resources> <DataTemplate x:Key="NormalTemplate"> ...

Using WrapPanel and ScrollViewer to give a multi-column Listbox in WPF

Hi I’m making a simple LOB app which loads data from an XML file and displays it in a list with a few buttons for editing. In my first attempt, everything was ok except that the list scrolled downwards in one long column. I would prefer the data to wrap so that at the bottom of the Window it starts a second column, and so on – if you r...

WPF Listbox not redrawing

I have a listbox defined in XAML as: <ListBox x:Name="directoryList" MinHeight="100" Grid.Row="0" ItemsSource="{Binding Path=SelectedDirectories}"/> The SelectedDirectories is a property on the lists DataContext of type List<DirectoryInfo> The class which is the datacontext for the ...

Html.ListBox

Hi I am trying to re-select items in a listbox with asp.net mvc Html.ListBox("SupplierId", new SelectList(Model.Suppliers, "Id", "Name", Model.SelectedSuppliers)) Here is the viewdata var viewData = new ViewData.SubstrateEditViewData( new DataAccess.SubstrateRepository().GetItemById(id), ...

WPF - ListBoxItem selection

I have a ListBox showing items using the following DataTemplate: <DataTemplate x:Key="PersonTemplate" DataType="{x:Type DAL:ResultItem}" > <StackPanel Width="280" > <TextBox BorderThickness="0" IsReadOnly="True" Background="Transparent" Text="{Binding FullName1, Mode=OneWay}"/> ... </StackPanel> </DataTemplate> I am using...

VB.NET: Is there a way to reduce the lag of loading a huge list of text lines to a listbox?

I am using file.readalllines to read the file into a string, then using listbox.items.addrange and splitting by vbcrlf to insert the items. Is there a way to reduce the lag it causes for loading huge lists? ...

How can I find an item in a WPF ListBox by typing?

Most list boxes allow you to find items within them by typing the first letters of the displayed text. If the typed letters match multiple items, then you can keep adding letters to narrow the search. I need to do this in a WPF ListBox. However, the items aren't plain strings -- they're custom objects that I present using a DataTempla...

WPF - Drag from withing DataTemplate

I have a ListBox displaying employees with a DataTemplate - it looks very similar to this screenshot. I want to be able to click on the employee photo, drag it and drop it somewhere out of the ListBox. How can I do that? I am not sure how to capture the PreviewMouseLeftButtonDown event of the Image, since it's inside the DataTemplate. E...

Automatic Scrolling in a Silverlight List Box

How can I programmatically force a silverlight list box to scroll to the bottom so that the last item added is always visible. I've tried simply selecting the item. It ends up as selected but still not visible unless you manually scroll to it. ...

ListBox select all items

Hi, I need to select all items in a listbox when a checkbox is clicked. Is it possible to select all items in the listbox using a single line of code? Or will I have to loop through all items and set selected to true for each one of them? Thanks :) ...