listbox

[WPF]: Weird problem With a ListBox

I have a weird problem with a ListBox in Wpf, where I have a binding to the ListBox SelectedIndex to a property in the viewModel object. If the SelectedIndex is less that zero, none of the listbox items are selected. However, if the SelectedIndex is set to a larger number than the actual size of the list, the last item is still selected...

Access Listbox Without Focusing in WinForms

am using c#, VS-2005 I have a TextBox and a ListBox. The cursor on textbox1. If i type in textbox then listbox searched the items it's ok. but i want when i press enter key listbox search items should replace in textbox1 without focusing. Is it possible to access any listbox event and up and down arrow key without focusing listbox? I ju...

ASP.Net -- <select> items not being posted back after jQuery populates list

I have an ASP.Net ListBox that I'm trying to populate via jQuery, using the following snippet: $("#MyList_btnAddAll").click(function(e) { e.preventDefault(); $('#MyList_lstAll option').appendTo('#MyList_lstSelected'); }); The code has two ListBoxes in fact, one a "source" and the other a "destination". As you can tell abo...

Silverlight: Listbox bind to CollectionViewSource\List update on remove of item.

I have a Listbox that I binds to a resource (sort) CollectionViewSource in my XAML. Then in my cs code I set the CollectionViewSource source to List of objects (class level field) I then have "remove button" that checks the selected items in the Listbox and removes them from the List of objects (class level field). I thought the Listb...

WPF ComboBox Residing in a ListBox Click Event

Hi All, I have a little issue. I have a a ListBox that is bound to a list of object. These Objects have a property that can be set. I have in the LIstBox ItemTemplate (a datatemplate) a combobox that is about to the objects property and the combobox has some hardcoded values. My problem is that when the list box is displayed and I cl...

Custom styled listbox - how can I keep the style for a selected item?

I have a styled listbox. Listbox items change color when hovered over and when selected. Hover and select work fine. But when selecting an item then taking the mouse off it and coming back to hover over it causes it to go back to hover/unselected state even though it is still selected. How can I keep the listboxitem in a "selected" visua...

What ListBox like control is used in Collections Editor of Visual Studio.

I need to create a from which uses the same ListBox as the one from Collection Editor of Visual Studio (The ListBox under the Members label). Please, explain exactly which WinForms control is this and which of its properties are set? You can see the control I am asking about under the Members: label of every collection editor form in d...

Display Microsoft Access data in textboxes by selecting an item in a listbox

I know how to connect to an access database and so on. My question is, I want to select an item from a list box, and then it must search the access database for the item I selected and display all its contents in textboxes. For example: In the listbox I have the following added: Car 1 Car 2 Car 3 etc. If I select Car 2, I want it to ...

Dual listbox, change element not possible

Hello, The code below works fines when I "hardcode" values but when I add the runat="server" with a binding in the code behind (for the sourceList), I can't anymore add/remove element from a list to another via jQuery Any idea ? <div id="Global"> <select size="10" runat="server" style="width:150px;" class="testMe" id="sourceSelect...

How would I know when to insert, delete or update based off a C# list?

Let's say that I have three tables "Person", "Area", and "Person_Area". Each person can work in many areas and each area can have many people in them. "person_Area" is a bridge table that contains person_id and area_id In my code I have two asp list boxes located on a person form. List box one contains all available areas and list b...

Scroll ListBox to top selection

Is there any way to programmatically scroll down a multiselect ListBox to show the top selection? Using ASP.NET here. UPDATE (to clarify): There's a form with a multiselect ListBox with a lot of items (country list), so not all of them are visible at the same time. The user makes one or several selections and saves the form. Later, the ...

Collection with 10 elements (only)

Hi, I would like to make a score list with only 10 elements. Basically, simple collection which adds the value. If new value is higher than other one it adds one and last one get out. (everyone knows how it looks like :) ) Secondly, I need a list of 5 lastest values that have been changed, something like history panel. All in all, both...

ASP.Net ListBox values not posting changes after jQuery manipulation?

Hi everyone, I have an ASP.Net page with two ListBox components, rendered in the browser as <select> lists. I'm using jQuery to move elements from one list to another by manipulating the DOM. I then select all elements with the mouse and postback the form. That way, all the list elements are posted with the form. When I submit the ...

Not all ListBoxItem are created equal.

Hello Everyone, In the example below, the DataTemplate only gets applied to the first and second list item, the third and fourth are completely ignored. <ListBox> <ListBox.ItemTemplate> <DataTemplate> <Button Content="{Binding}"></Button> </DataTemplate> </ListBox.ItemTemplate> <sys:String>One</s...

Suggestions for synchronization of lists in Silverlight

Hi, We are creating a business application (Silverlight 4) at our company where we, in several of our views, use the functionality to synchronize two lists of some kind. More precise we are, at the moment, using two list boxes (one source and one target) and two buttons (one add and one remove). Both the source list and the target list...

Paging a Listbox control in WPF

Hello, I have a WPF ListBox with it's ItemSource property bound to an ObservableCollection. Each ListBox Item has many controls that could take some time to load up. I would like to only display/load 5 ListBox items at a time, with some paging support or a "Next" button or something similar. Currently I plan to do this manually and j...

How to change ListBox selection background color?

It seems to use default color from Windows settings which is blue by default. Let's say I want to change it to red permanently. I'm using Winforms. Thanks in advance. ...

Sorting a list of items in a list box

I want to get an bunch of items from a list box, add them to an array, sort it, then put it back into a different listbox. Here is what I have came up with: ArrayList q = new ArrayList(); foreach (object o in listBox4.Items) q.Add(o); q.Sort(); listBox5.Items.Add(q.ToString()); But it doesnt work. A...

Selecting items in a ListBox

I have a method that fills a ListBox with objects (custom class) internal void UpdateList() { foreach (Item item in Container.Items) List.Items.Add(item); } Container also is a custom class that holds a List<Item> where all objects of this container is stored. Now, the user can select (using a ComboBox) to display a certain Contai...

Using xaml resources, but keeping unique content per reference

I have several ListBoxes and have set up the group style to make the groups expanders. I want all of the ListBoxes to use the same style information to make them all expanders, but i want to be able to change the content of the header to be custom for each use of the style. Is there any way i can take the out of the but still edit the...