listbox

Data validation for multiselect ListBoxes in Silverlight

I have a ListBox with SelectionMode set to Multiple. I'd like to add special data validation to the control so that if you select all of the items, the ListBox gets the red border and has a "You cannot select all of the items" error message. I was able to get it to work--but it's a hack. I'm hoping there's a cleaner way to do this. Here...

WPF ListBox Databinding & Events

My problem is rather simple. I have a ListBox, containing Thumnails (Image) <ListBox Name="ListBox_Thumbnails" ItemsSource="{Binding}" DataContext="{Binding Source= {StaticResource ThumbnailListSource}}" Width="120" HorizontalAlignment="Left" Margin="-1,26,0,54"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> ...

CheckBox inside ListBox

Hi, How to add checkbox inside the listbox. Where ChechBoxList controls is not good for more records, By using listbox user can easily scroll to choose the item. Geetha. ...

How to do a dual listbox set up in ASP.Net MVC?

This may be silly, but trying to do a dual list box in ASP.Net MVC. I have the client side part working fine with options moving back and forth, but what I would like is for the person to be able to save when they are done. This means I have to post all of the values in the "selected" list box. I don't want to rely on the user leaving th...

WPF: ListBox - setting focus on an item breaks keyboard navigation

After selecting ListBox item programmatically it is needed to press down\up key two times to move the selection. Any suggestions? View: <ListBox Name="lbActions" Canvas.Left="10" Canvas.Top="10" Width="260" Height="180"> <ListBoxItem Name="Open" IsSelected="true" Content="Open"></ListBoxItem> <ListBoxItem...

Mouse Clicks not recognized in ui-Moving mouse out of Application bounds fixes it

Hi, I am trying to implement a drag and drop between listboxes.I successfully implemented it using the library from http://code.google.com/p/gong-wpf-dragdrop/.Everything works fine but when i had to call some custom logic which involves some selection changed events also,My ui fails to detect mouse clicks anymore.No control in my hole a...

Binding a WPF Listbox to Xml in Button_Click event?

Hi, I am trying to bind a ListBox to Xml in Button_Click event in xaml.cs. my Xml is simple <books> <book>ABC/book> <book>XYZ</book> </books> Here's what I am doing.. in xaml.cs XmlDocument x = new XmlDocument(); x.LoadXml(e.Result.ToString()); listbox1.ItemsSource = x; and Xaml ...

How to change height of owner drawn listbox dynamically in windows mobile?

Hi, I am trying to create owner drawn listbox on windows mobile 6.1 I have specified LBS_OWNERDRAWFIXED style while creating listbox control. I am handling WM_MEASUREITEM and WM_DRAWITEM accordingly. I want to change height of listbox item whenever its font changes (I change it using WM_SETFONT after creating control). The problem is ...

WPF: How to bind to different objects?

I have a ListBox containing CheckBoxes. Xaml looks like this: <ListBox x:Name="lbContactTypes"> <ListBox.ItemTemplate> <HierarchicalDataTemplate> <CheckBox Content="{Binding Path=Description}" IsChecked="{Binding Path=ContactTypes, Converter={x:Static Classes:ListContainsConverter.Instance}, ConverterParameter=1}...

Padding text in listbox

Hi everyone, var a1 = "HEL"; var a2 = "HELLO"; var a3 = "LLO"; var length = a2.Length+5; listbox.Items.Add(a1.PadRight(length) +"End"); listbox.Items.Add(a2.PadRight(length) + "End"); listbox.Items.Add(a3.PadRight(length) + "End"); I have code like this to obviously pad all text...

Selecteditem color in textBlock in ListBox in WPF

Hi,I have textblcok in my listbox as listboxitem.When i seelct the item in that,it shows blue in color.I dont want that.How can i remve that. My XAML: <ListBoxItem> <StackPanel Margin="10,5,0,0" Name="Stack1" Orientation="Horizontal"> <Image Margin="10,0,0,0" Name="Img1" Height="15"></Image> ...

How to refresh ListBox.ItemsSource in a SilverLight 3 project?

I my XAML, I have a ListBox defined <ListBox x:Name="lstStatus" Height="500" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" VerticalAlignment="Top" Margin="2, 2, 2, 2"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Image /> <TextBlock Widt...

How to set default selected item of listbox in winform c#?

I try to set like this: ListBox lb = new ListBox(); /* Bind datas */ lb.SelectedItem = someObject; lb truely selected the someObject item. But it would select the 1st item at first. And that motion cause SelectedIndexChanged event which I don't wanted. I just want SelectedIndexChanged be called when someObject selected. How co...

Problem in givin SelectedIndex -1 in Listbox

Hi,Im having listbox and getting selected item.The code is private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e) { int index = listBox1.SelectedIndex; string str =""; if (index == 0) { str = (string)Text1.Text; } ...

django- search for list box elements and palce the selected elements in another box

I want a search for my list box.The selected items should then be shifted into another box.The same functionality is provided by django admin where you add user permissions.Any idea how I can implement it in my app? Thank u !! ...

Java Swing: Set member which is displayed in JListBox

Is there a comparable mechanism to the .NET "set DisplayMember" for the JListBox Swing component? Overriding the toString() method is not sufficient because I also want to be able to change the display member at runtime. I also looked into implementing my own ListCellRenderer, but found it not very convenient. Ist there a easier or mo...

as3 sorting xml data ?

I have xml data that I can load into my flex app; however, I need to sort it by node. I'm trying to create a combobox or listbox that can display a list of locations sorting them either alphabetically or by the category they are in... I can't get my head around how to format the xml or how to code the flash file to sort according to lo...

Listbox appears through modal popup extender

I have a base page in which i have a listbox. The base page is also having a modal popup extender. When the modal popup extender appears over listbox, the listbox appears through modal poup. That is, only for listbox, the popup extender becomes transparent. What shud I do for this? ...

How to make list item horizontally stretched ?

Here is a window with a simple list: The code is straight-forward: <Window x:Class="Wpf_List.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" Title="MainWindow" Height=...

Foreach statement in listbox c#

Hey, I have a problem with a foreach statement in my project. So far I have the code: foreach(object i in listboxFiles.Items) { if (i == ".ftpquota") { listboxFiles.Items.Remove(i); } if (i == ".") { listboxFiles.Items.Remove(i); } if (i == "..") ...