listbox

WPF ListBox as RadioButtonList - mimic SelectionChanging Event via WPF validation

I am using ListBox for having RadioButtonList behaviour (that's what people recommend as there is no inherent radio button list in WPF). The listbox is bound to a ViewModel. Now, whenever user changes the selection on listbox, I want to check whether user has some unsaved data on the part of screen and prompt accordingly (typical yes,no...

Listboxes, scrolling in sync

Hi Everyone, I have 2 listboxes, same size, next to each other. Basically I am using them to represent linked items...Similar to having 2 columns and a number of rows in excel, with say, first name in one and last name in the other. I am wondering if I could make it so that when one listbox is scrolled, the other listbox scrolls in syn...

.Net C# windows forms, listbox control question

I have a pretty simple form with a listbox, a text box, and two buttons. The list box items are populated from a sql database table. The user may chose to select one or multiple items from the listbox. The text box is used to write more details about the items in the listbox. One button can then be clicked to update another database t...

CheckedListBox SetItemCheckState

i have: ListenCheckedListBox.SetItemCheckState(0, CheckState.Unchecked); will this assignment trigger the ListBox's ItemCheck event? because the above statement is not changing its status from checked to unchecked. and in the ItemCheck im toggling its CheckState also. that why im wondering that because of this code the checked status...

How to automatically select first item in a bound silverlight listbox?

Using silverlight, I have a listbox with ItemsSource bound to an ObservableCollection which is updated asynchronously. I would like to automatically select the first item in the listbox as soon as the binding is finished updating. I can't find a good way to make this happen. I don't see any useful events to handle on the listbox and i...

asp.net mvc 2 multiple selection listbox. how to read values in controller

I'm having a hard time getting a fairly simple binding to work. When editing an employee I want to display a listbox containing all the available roles in the system, (the employee's roles selected), and when saving the employee I want the selected roles to get populated by MVC into the Employee object which comes as an input param to ...

Adding Item in ListBox with different FONT c#

Hi, I want to add some item in ListBox with different font that I specify at runtime in somewhere in code How can I do that. ...

How do I get all the values in a listbox when looping through them?

I'm currently trying to move through all the values added to a listbox by the user, however, I want to retrieve the actual value of each item in the listbox and not the text. I've gotten so far with the code below, but that only gets the text and not the value. For Each item In SelectedStoresLB.Items Dim tCompany As Integer...

Listbox is null, when passing a query string and processing data on load.

Hi guys got a wired problem (well I find it a wired problem :P) I have an order page done in asp.net c#, and which a user adds ingredients to a set of list boxes, once the user and finished adding items, they get combined to make a sandwich then added to another list box that shows the sandwiches and their ingredients. I also have a but...

Windows.Forms.ListBox OwnerDrawVariable measuring problem in MeasureItem

I have a baffling problem that I've been stuck on for hours and can't find a fix for. I have inherited a class from the ListBox class so that I can create multi-line and multi-coloured item content. I have the following in the MeasureItem method: SizeF headingSize = e.Graphics.MeasureString(exam.Name, HeadingFont, ClientSize.Width); Siz...

Clear wpf listbox selection using button in control template and no codebehind

I want to create a style for a WPF listbox that includes a button in the control template that the user can click on and it clears the listbox selection. I dont want to use codebehind so that this style can be applied to any listbox. I have tried using event triggers and storyboards and it has proved problematic as it only works first t...

Multi selection list box in WinForms

Hi I am looking for way to implement multi selection enabled list box in windows forms C#. Any suggestions? Thanks. ...

How to: A ListBox from two sources?

I am using EF with WPF. How should I create a ListBox that shows both Contacts and Persons? My question is rather how to retrieve it and create the CollcetionViewSource(s). I know I will have to use ItemTemplateSelector, that's less what I care, what I really care is the retrieval, but any tips on the representation will be welcommed as...

How can a list box disallow duplicate items?

I was looking at http://delphi.about.com/od/tlistbox/a/list-box-onchange-drag-drop.htm and I was wondering if it would be possible to add the ability to disallow duplicate items like this, and if so how would I go and do it? Thanks -Brad ...

asp.net mvc multiselect remember state after postback

Hi, I am using the DataAnnotations for error checking on my asp.net mvc app, I am also using strongly typed ViewModels too. My error checking is working fine and is posting back to my view with error messages if a field is blank. However i have a MultiSelect / Listbox on my form which i need to remember it's state after an error. At t...

navigation list issue

Hi All, I am working on a small application below where there is a collection of list items all list items should be within the box no matter how many they are like they can be on the second column. Also I want to keep a limit on the number of list items that can be displayed like not more then say 10 so the moment there are 10 items th...

WPF ListBox: how to update data with binding

I have listbox that displays information about list of objects: <ListBox Grid.Column="0" Height="152" Name="CustomersList" HorizontalAlignment="Stretch"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Path=Name, Mode=OneWay}"/> <...

C# ListBox ObservableCollection<T>

I'm trying to use a ListBox.DataSource = ObservableCollection, however I can't figure out how to have the listbox automatically update when my OC updates. I can hook the CollectionChanged event on the OC, however what do I need to do to the listbox to make it update? ...

DataRelation between two data tables - can't bind data to a listbox (C# .NET 3.5)

C# (.NET 3.5) I have an SQLite database with two tables - employees (the first column being id INTEGER PRIMARY KEY), and holidays (id INTEGER - meaning the ID of the employee; start DATE, end DATE - self-explanatory). My form contains textboxes, checkboxes etc. to represent the employee details - but say I'd also like a list box, listi...

ListBox, list of different objects implementing the same interface

Hi! I have two objects: User and Client, both implements interface IMember interface IMember { int Id { get; set; } string Name { get; set; } } In a form I set ListBox data source: myListBox.DisplayMember = "Name"; myListBox.ValueMember = "Id"; myListBox.DataSource = membersList; // List<IMember> And wierd things happen ...