listbox

WPF Listbox with checkboxes appearing blank, added dynamically

I'm trying to populate a listbox with a series checkbox entries, however once running the code below the listbox has blank entries in it, which are selectable, i.e. a blue bar appears. However neither the text or checkbox appears. for (int num = 1; num <= 10; num++) { CheckBox checkBox = new CheckBox(); checkBox.Text = "sheet" + ...

Binding a listbox SelectedItem to an Observable Collection?

I have a Listbox in WPF with the SelectionMode set to Multiple, and can multiselect the items in the Listbox. However, the SelectedItem is not updating the Observable Collection it is bound to. Is there a way to bind the multiple selected items from a ListBox to an Observable Collection? ...

WPF - How do I get an object that is bound to a ListBoxItem back

Hi there here is what I would like to do. I get a List of objects from a database and bind this list to a ListBox Control. The ListBoxItems consist of a textbox and a button. Here is what I came up with. Up to this point it works as intended. The object has a number of Properties like ID, Name. If I click on the button in the ListBoxIte...

list box asp.net selected problem

When I choose am item from "kategorije", new items are loaded into "SUB_kategorije", but when I choose the item from SUB_kategorije and when i click on button it shows me this error: Object reference not set to an instance of an object. Line 101: kom.Parameters.Add("@podkategorija", SqlDbType.Text).Value = SUB_kategorije.Sele...

Scrolling list items in wpf

I guess the following picture depicts the problem better than texts... That is what I need. <ListBox x:Name="NamesListBox" ItemsSource="{Binding}"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel x:Name="ItemWrapPanel"> <WrapPanel.RenderTransform> <TranslateTransform ...

Binding Listbox Items

Hi, I have a user with it's roles, it's an entitycollection. I have a ListBox that has all possible roles, and I have them like checkboxes, but I want to bind the IsChecked property of each one to check if the user has the role. Something like IsChecked={Binding Roles.Contains} ...

How to program "Selection Changing" event in ListBox in WPF?

I have a listbox and I want to prevent changing of ListBox's selection if user has not finished certain tasks, this is the best explanation i can provide at this time, in WinForms there used to be selection changing and it has cancellable event arguement, where in we could trap and cancel even of changing the selection. I thought I will...

Parse XML and populate in List Box

I'm a newbie to C#. I want to develop C# List box in Windows Form. I found this link to be helpful. But the input to the List box will be an XML of the following format: <LISTBOX_ST> <item><CHK></CHK><SEL>00001</SEL><VALUE>val01</VALUE></item> <item><CHK></CHK><SEL>00002</SEL><VALUE>val02</VALUE></item> <item><CHK></CHK><SEL>00003</SE...

Parse XML and populate in List Box

I've posted the same question here and I've also got couple of good answers as well. While I was trying the same answers, I was getting compilation errors. Later I got to know that we are using .NET 2.0 and our existing application has no references to LINQ files. After searching in SO, i tried to figured out partly: public partial cla...

Customising Silverlight AutoCompleteBox with multiple filtered ListBoxes

Hi, How should I go about customising the AutoCompleteBox in Silverlight so that while typing I can filter multiple Selector ListBoxes. Basically I want a Popup that contains 'n' ListBoxes vertically stacked and when I type, the filtering operates on all of them simultaneously. I can then select an item from any of the ListBoxes. Thank...

ScrollViewer in a ListBox not working. WPF.

Hi, I have the following defined in my control: <Style TargetType="primitives:CalendarDayButton" x:Key="EventCalendarDayButton"> <Setter Property="Background" Value="#FFBADDE9"/> <Setter Property="MinWidth" Value="5"/> <Setter Property="MinHeight" Value="5"/> <Setter Property="FontSize"> <Sett...

Silverlight 3.0 Custom ListBox DataTemplate has a checkbox, checked event not firing

The datatemplate for the ListBox is set dynamically by XamlReader.Load. I am subscribing to Checked event by getting the CheckBox object using VisualTreeHelper.GetChild. This event is not getting fired Code Snippet public void SetListBox() { lstBox.ItemTemplate = XamlReader.Load(@"<DataTemplate xmlns='http://sch...

Having hard time binding array of object from web service call to wpf listbox

Hello guys! i started a WPF application (with vs 2008 sp1) which connects to a web service to get Collection of objects. I can be contactInfo[] or groupInfo[]. here is my main.xaml.cs public main() { InitializeComponent(); //service.addContactCompleted +=new addContactCompletedEventHandler(addContactCompleted); ...

WPF WrapPanel - all items should have the same width

I have a ListBox whose ItemsPanel I have replaces with a WrapPanel. The WrapPanel now hosts the databound ListboxItems. Each item has a variable sized text in it, giving each item a different width. However, I want the width to be constant so that all items have the same width as the item with the longest text. Is that possible? ...

Wpf binding with nested properties

ViewModel I have a property of type Member called KeyMember. The 'Member' type has an ObservableCollection called Addresses. The Address is composed of two strings - street and postcode . View I have a ListBox whose item source need to be set to ViewModels's KeyMember property and it should display the Street of all the Past Addresses...

How to handle with multiple selection ListBox? asp.net c#

In my aspx registration page i have more then 6 item available in my list box, I am allowing multiple selection on it..I am not sure about how many items i will select each and every time. then how i have to store it into dataset and how to pass it as a mysql paramter... ...

In a Windows forms application, how can I use a listbox in a DataGridView coloumn instead of a combobox

I'm working on a windows forms application that uses a DataGridView. Some of the cells contain a DataGridViewComboBox. In some cases, I have several values to display in the combobox. For that scenario, it would be better to use a ListBox instead of a ComboBox. Is it possible to use a multi-column listbox within a DataGridView instead of...

listbox bound to a Specialized.StringDictionary does not update

I've got a listbox (listStorageLocations) - thats bound to a BindingSource called listStorageLocationsBindingSource. This BindingSource is bound to a collection of StringDictionary items in my Settings.Default.StorageLocations. The listbox's datasource is then set to the bindingsource. I cannot for the life of me get anything to display ...

AJAX in ASP.NET and VB.NET

I'm developing an application in ASP.net and coding in VB.NET. On a page when a User select some items from a multiple select list box and click finish,the mulitple select list box need to be reloaded through AJAX and Items previously selected must not be displayed after reload. Also, the inverse of this. Page shows individually, the ite...

Change the spacing on a listbox control in silverlight

Space between items is to much. how can I lessen it? ...