listbox

Take advantage of ListBox multicolumn property

Is possible to take advantage of MultiColumn property when Items collections are managed by a DataSource? (Use of DataBound items). I want to try the following snippet : this.listBox1.Items.AddRange(new object[] { "Item 1, column 1", "Item 2, column 1", "Item 3, column 1", "Item 4, colum...

WPF ListBox control horizontal scrolling in code

How can I set the horizontal scroll position of a list box in code? I have a list box with a wrap panel in the items template and I want to implement a 'page right' function that behaves like a page down down in a normal list but works sideways. Thanks! ...

WPF ListBox drag & drop interferes with ContextMenu!?

I'm implementing drag & drop from a ListBox, but I'm seeing some strange behaviour with a ContextMenu elsewhere in the window. If you open the context menu and then start a drag from the ListBox, the context menu closes but won't open again until after you perform another drag. Does this make sense? Anybody got any ideas what might be...

WPF Treeview and ListBox synchronization

I have a treeview which shows a hierarchy of items where each item has a checkbox. I would like to show below the treeview a listbox with all the checked items. How to achieve such functionality using MVVM pattern? Thanks in advance Lukasz Glaz ...

C# - How to fill a multicolumn listbox

Good afternoon. I know how to create the listbox but i am having some problems to fill a multicolumn listbox. How can i do it? Thank you. ...

I can't seem to add a column header to a list box in an inherited MFC dialog. What's wrong?

Hi, I have a CStdDlg thats inherits from a CDialog class. In the CStdDlg dialog, I have a list box (m_lcList1), edit box (m_ceEdit1), a radio button(m_rbButton2) and buttons OK, Cancel and Button1. I am trying to create another class named CDerivedDlg that inherits from CStdDlg. I want to use everything in CStdDlg but from the CDeriv...

Have a databound WPF Listbox generate subclassed ListboxItems

I would like to have my WPF Listbox, which is databound, generate subclassed ListboxItems instead of the regular ListboxItems. In this case, a DataTemplate is not sufficient because I need some custom properties for the subclassed ListBoxItems. Is there a way to have the ListBox generated mySubClassedListBoxItem items for the bound data...

Getting all selected values from an ASP ListBox

I have an ASP ListBox that has the SelectionMode set to "Multiple". Is there any way of retreiving ALL selected elements and not just the last one? <asp:ListBox ID="lstCart" runat="server" Height="135px" Width="267px" SelectionMode="Multiple"></asp:ListBox> Using lstCart.SelectedIndex just returns the last element (as expected). Is th...

Custom Listbox: Limit Maximum Item Count

I have silverlight 3.0 project that has a listbox that is databound to a list of items. What I want to do is limit the number of items displayed in the listbox to be <= 10. I originally accomplished this by limiting the data bound to the list to 10 items by doing a .Take(10) on my orignal data and databinding the result. The problem...

Implement a listbox

I need to implement a listbox for a mobile. The only relevant controls are up and down arrow keys. The listbox should display as many rows of items from a list as will fit on the screen (screen_rows), one row should be highighted (sel_row) and the display should wrap if the user hits up arrow when the first item is highlighted or down ...

WPF Sidebar style drag and drop

I'm trying to write a WPF control that has similar functionality to the Windows Sidebar. The functionaly I would like to replicate is the drag and drop ordering. When dragging an item the other items move out of the way to show you where the item will end up when dropped. Has anyone else had to implement this sort of functionality, if ...

Prevent ListBox from focusing but leave ListBoxItem(s) focusable (wpf)

Here is what happens: I have a listbox with items. Listbox has focus. Some item (say, 5th) is selected (has a blue background), but has no 'border'. When I press 'Down' key, the focus moves from ListBox to the first ListBoxItem. (What I want is to make 6th item selected, regardless of the 'border') When I navigate using 'Tab', the Lis...

Selecting an item in an list box (asp.net 3.5)

Hi, Say I have a listbox lb, which I initialize using: lb.DataSource = wordList \\wordList is a list of strings lb.DataBind() The listbox is initialized perfectly, and everything that should appear there does. However, now I select one of items in the listbox with my mouse (coloring it dark blue, in case anyone wondered what I mean...

Retrieve value of most recently SelectedItem from multi-select listbox

How can I retrieve the value of a clicked item in a multi-select listbox? Currently, if I click one item and use lstBox.SelectedValue, it will return the proper value; however, if I then click on another item, I am still shown the first item's value. Basically, I want the value of the item most recently clicked on, regardless of whet...

How can I get the last selected value in a ListBox with jQuery?

Hi!! I have a listbox and I must limit its selection up to 5 items. If a 6th item is selected, I want to "deselect" it. But, I'm having some problems on finding the last selected item and "deselect" it. And the last item selected it's necessary the $("#mySelect option:last")... How can I get the selected item of a listbox?? Thanks!!!...

How do I get the number of the item selected in a listbox (C#)

I'm trying to get the integer value of The number selected of the item. For example [Sample List Box] Beans Rice Can Potatoe [/Sample List Box] Rice is number 2 How can I do that in C#? ...

WPF listbox : problem with selection

Hello. In my XAML file, I have a ListBox declared like this : <ListBox x:Name="lstDeck" Height="280" ItemsSource="{Binding Path=Deck}" > <ListBox.ItemTemplate> <DataTemplate> <ListBoxItem Content="{Binding}" /> </DataTemplate> <...

ListBox doesn't show changes to DataSource

I thought this was a simple problem, but I can't find any information on the web. I'm binding a ListBox to a List using BindingSource like so: List<Customer> customers = MyMethodReturningList(); BindingSource customersBindingSource = new BindingSource(); customersBindingSource.DataSource = customers; customersListBox.DataSource = cust...

Problems using ListBox and observable collection as a debug log

I have a listbox bound to a view model observable collection: This works fine, minus one little hitch... assuming that the observable collection contains strings, the whole thing breaks down when entries with identical values get added to the collection, what is the best way to handle this? Custom struct instead of strings and then a ...

Working with listbox in winforms (c#)

Hi, How can i add 10 items to listbox dynamically to a listbox and after that I want to show the selected item value in click event of list box. I tried like this for(int i=1;i<10 ;i++) { mylistbox.Items.Add(i.ToString()); } in click event handler MessageBox.Show(mylistbox.SelectedValue.ToString()); it is showing error. Whats th...