listbox

WPF: ListBox vs. ListView - how to choose for data binding

I'm considering either a ListBox or a ListView for a WPF application. It seems either supports data binding and item templates. My application has a simple list of items that I intend to be able to search/sort/filter based on user input. The data binding demo (http://msdn.microsoft.com/en-us/library/ms771319.aspx) uses a ListBox with ...

How do i split a String into multiple values?

How do you split a string? Lets say i have a string "dog, cat, mouse,bird" My actual goal is to insert each of those animals into a listBox, so they would become items in a list box. but i think i get the idea on how to insert those items if i know how to split the string. or does anyone know a better way to do this? im using asp c# ...

Multiselect listbox binded to database in Delphi 6.

I'm using Delphi 6, and I want a database binded list box with multiselect. I found three types of List boxes: TListBox, TDBListBox and TDBLookupListBox. As far as i can understand, TListbox is not binded to database. TDBListBox and TDBLookupListBox can't be multiselected. Is there a way to get a multiselect listbox binded to databa...

The DrawItem() method is performed repeatedly

I used the owner-drawn strategy on CMyListBox class which derives from CListBox. I only want the DrawItem() method to perform when I insert an item in the listbox. But the method is invoked many times. How can I change to invoke it whenever I need. ...

How do you access the DisplayMemberPath from a ListBox when trying to bind it to the content of the ListBoxItem?

I have overridden the windows ListBox in order to display an image and a piece of text in each ListBoxItem, but I need to filter the contents of the text displayed I was hoping to do this by accessing the DisplayMemberPath of the actual ListBox however I can't get it working. <Setter Property="ItemContainerStyle"> <Setter.Value>...

WPF Trigger for IsSelected in a DataTemplate for ListBox items

Hi, I have a listbox, and I have the following ItemTemplate for it: <DataTemplate x:Key="ScenarioItemTemplate"> <Border Margin="5,0,5,0" Background="#FF3C3B3B" BorderBrush="#FF797878" BorderThickness="2" CornerRadius="5"> <DockPanel> <DockPanel DockPanel.Dock="Top" Margin="0,2,0,0"> ...

A better way of forcing data bound WPF ListBox to update?

Hi,, I have WPF ListBox which is bound to a ObservableCollection, when the collection changes, all items update their position. The new position is stored in the collection but the UI does not update. So I added the following: void scenarioItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChange...

How do you access the ScrollViewer element of a ListBox control in Silverlight/C#?

I wish to dynamically change the scroll position of a Silverlight ListBox from C#, and I need to know how to access the ScrollViewer element of a ListBox control from C#? Thanks guys, Jeff ...

How do I synchronize the SelectedItem of a ListBox?

I have this ListBox which is bound to an ObservableCollection. Each object in the list implements an interface called ISelectable public interface ISelectable : INotifyPropertyChanged { event EventHandler IsSelected; bool Selected { get; set; } string DisplayText { get; } } I want to keep track of which object is selected...

listbox validation

how do i check if an item is selected or not in my listbox? so i have a button remove, but i only want that button to execute if an item is selected in the list box. im using asp.net code behind C#. I'd prefer if this validation occurred on the server side. cheers.. ...

insert html listbox items from database

how do i insert items into an html listbox from a database? im using asp c#. i cant make the listbox run at server because the application wont work if i do that. so i have to insert values from a database into an html listbox. I just need to display 1 column of data. cheers.. ...

Allow vertical scrolling in listbox, when it is disabled (VB6)

I need to allow the vertical scrollbar in a multiselect listbox (VB6) however, when the control is disabled, I can't scroll. I would think there is an API to allow this, but my favorite VB6 site (MVPS VB.NET) does not have a way. I toyed with pretending it was disabled, and ignore the clicks... but to do that with VB6 code is really ug...

Best way to change ListBox selection to be a toggle selection

I have a ListBox control that I want to change into having a toggle selection. i.e. Click once on an item selects it, click again it deselects it. Also, clicking another item in the list should do the default action of deselecting the previous item and selecting the new one. What's the best way of achieving this? ...

How to get the last selected item in multiselect ListBox?

How to get the last selected item in a .Net Forms multiselect ListBox? Apparently if I select an item in the listbox and then select another 10 the selected item is the first one. I would like to obtain the last element that I selected/deselected. ...

How can I make some items in a ListBox bold?

In Visual c# Express Edition, is it possible to make some (but not all) items in a ListBox bold? I can't find any sort of option for this in the API. ...

wpf listbox change individual items to bold

I want some of the items to be bold depending on a property of an object i'm putting into the listbox. I think you can do it with changing templates but can't seem to find an example. Thanks! ...

WPF: use a ListBox in a template that will be the template of another ListBox

I have a ListBox whose ItemSource is an ObjectDataProvider that is an instance of an ObservableCollection. The ObservableCollection is a collection of ObservableCollections. The ItemTemplate of the ListBox is a DataTemplate that creates a ListBox for each item of the listbox. To illustrate this better I'm trying to recreate a card game i...

WPF Xaml Custom Styling Selected Item Style in a ListBox

I have a list box that scrolls images horizontally. I have the following XAML I used blend to create it. It originally had a x:Key on the Style TaregetType line, MSDN said to remove it, as I was getting errors on that. Now I'm getting this error: Error 3 Operation is not valid while ItemsSource is in use. Access and modify elements w...

Making a control "transparent" to click events

I have a ListBox displaying some items, and in certain modes I "stamp" a kind of watermark across the top of it. I've done this with a Border containing a TextBlock with an Opacity of 0.5. All this works nicely. However, I still want the user to be able to click on the items in the ListBox but if I click on the "stamp" it obviously eats...

How can I disable horizontal scrolling in a WPF listbox?

This seems to be an absurdly simple question but Google and SO searches yield nothing. How can I disable horizontal scrolling in a WPF listbox when items take up more horizontal space than is available in the box? ...