listbox

How to add toolbar to bottom, top, left, or right of the inside of a listbox in WPF?

I have a listbox with a style that has rounded corners. I'd like to add a toolbar inside the listbox that pertains to that specific list box. Currently, if I add a toolbar inside the grid that contains a listbox, it will overlap the last item in the row (depending on the height of the toolbar). Does anyone have any ideas on the best w...

How to Convert a Tcl Listbox Numerical Indice to its Element

Hello: I feel that this question has a simple answer; but, for the life of me, I could not figure it out. I am trying to convert a listbox selection to its string element so I can enter it into a database. I understand that I can use .listbox curselection to get its index; however, I need to convert it into its string. Can anyone h...

get object out of telerik radcontrol for winforms binding

Hello, I hope that someone can help me with an issue related to binding a bindable collection class to one of the Winforms Telerik list controls. If you bind to a plain ole windows list control like this... dim list as new listBox with list .DataSource=myCollectionClass 'this contains a collection of widgets. .ValueMember=...

Why do ListBox.ObjectCollection and ListView.ListViewItemCollection have AddRange but not InsertRange or RemoveRange?

So, both ListBox.ObjectCollection and ListView.ListViewItemCollection implement the IList class, which provides Add and Remove methods but no AddRange, InsertRange, or RemoveRange. However, ListBox.ObjectCollection and ListView.ListViewItemCollection also provide an AddRange method -- just no InsertRange or RemoveRange. Look at the Arra...

WPF - How to make RadioButtons generated by a DataTemplate be mutually exclusive?

One of the apps I am building needs to build a survey for users to take. The relevant classes related to my question are: Survey (string Description, List<Questions> Questions, QuestionTypes Type) Question (string Description, List<Choice> Choices) Choice (string Description) enum QuestionTypes {MultipleChoicesOneAnswer, MultipleCho...

WPF - prevent ListBox item selection

I would like to prevent selection of ListBoxItems in my ListBox. My DataTemplate has a checkbox and this should be the only thing the user can click or select. How can I do that? Thanks! ...

Disable dynamic searching when typing in a listbox

In VB6, if a listbox containing alphanumeric data has focus and a character key is pressed, the first element in the listbox starting with that character is highlighted. If multiple characters are pressed, the first element starting with each character is selected after each character press. Typing M-A-R-T will select the first M-word,...

How to bind Dictionary to ListBox in winforms

It is possible to bind a dictionary to a listbox, keeping in sync between the listbox and the member property? ...

List box context menu

How do I add a context menu in a list box in MFC? I don't see any WM_CONTEXTMENU handler in list box's properties. Any ideas? EDIT: I followed this tutorial MFC List Control: How to use a context menu in a list control?. The tutorial says to derive my own class from CListBox which I did, but now how do I add list box of my derived class...

Dynamic DataTemplates (pref. Silverlight)

Is it possible to have a ListBox with a Data Template that changes depending on certain properties of the ItemsSource? For instance maybe you want a list with a variety of items such as images, video, custom panels, etc. Was hoping it could behave like some sort of factory. Any ideas how this would work? ...

Showing message only once

The below code is in OnTimer event. If items from 2 list boxes are not matching - ShowMessage. I need to show the message only once, but because the timer is running, the message keeps popping up at the timer's set interval. I tried disabling the timer after ShowMessage line but then the message would even show. for i := 0 to ListBox2.I...

Making WPF ListBoxItems selectable

I have a ListBox with a rather simple ItemTemplate defined - containing a TextBlock and a Button. This displays like expected, but there is a problem though. When I click the content of the ListBoxItem, i.e. the text or the button, the line doesn't get selected in the ListBox. If I click the blank parts of the line it does. I'd like the ...

Add option from server to existing Listbox

HI I have an HTML ListBox which contains values of email domains taken from a properties file. In one case, when the page has to be edited, I need to bring the email address value from server and split into two and load the email address into text box and list box for example: [email protected] will be split as myname and gmail.com and m...

How to force a ListBox to reload data in WinForm

I have a ListBox on a Windows Form that is populated during the Form_Load event like so. private void Form1_Load(object sender, EventArgs e) { SA.Business.ComputerList computerList; computerList = SA.Business.Business.GetComputerList(); this.lbComputers.DataSource = computerList; this.lbComp...

How do I center ListItems in a WPF Listbox? Orientation is horizontal.

I am trying to lay out my listitems in the lisbox so they stay in the center. The list box is horizontal by orientation. ...

Change ListBox item style at run-time

I have a listbox where the items are styled using a ResourceDictionary style which is then attached to the ItemContainerStyle property. This gives my ListBoxItems a BorderThickness of let's say 1. Now I want to collapse the items individually, so I use Visibility.Collapsed but for some reason the border that the ItemContainerStyle has c...

Change how items are displayed WPF list box

I have a WPF window which displays a ListBox. I've changed the ListBox's item template so that the list box displays rectangular items which can be selected. Now I'd like to modify the ListBox's ItemsPanelTemplate so that the items are displayed in a grid instead of either a vertical or horizontal list. Specifically I'd like the first i...

How can a WPF ListBox, with a custom ItemsPanel template, resize itself based on the size of its items

This is a follow up question to this, which was answered. Using the code <ListBox ScrollViewer.VerticalScrollBarVisibility="Disabled"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel Orientation="Vertical"/> </ItemsPanelTemplate> </ListBox.ItemsPanel> </ListBox> you can create a list where the items populate...

WPF Drag & drop from ListBox with SelectionMode Multiple

I've almost got this working apart from one little annoying thing... Because the ListBox selection happens on mouse down, if you start the drag with the mouse down when selecting the last item to drag it works fine, but if you select all the items to drag first and then click on the selection to start dragging it, the one you click on g...

Accessing child of ListBoxItem

I have a ListBox with a DataTemplate that looks like this: <ListBox Name="listBox"> <ListBox.ItemTemplate> <DataTemplate DataType="x:Type local:NumericIconDefinition"> <Grid> <ComboBox Name="IconComboBox"/> </Grid> </DataTemplate> </ListBox.ItemTemplate>...