listbox

alphabetical search in listbox C#

I am writing a program, a crystal report program. I got 2 listboxes in the program. 1 is for the question and 1 is for staff names. I can search by alphabetics for question listbox. Means there are 4 items in the listbox namely 1,2,3,4. if i press "1" on the keyboard, selected index will change to 1. Question listbox is single sele...

Transferring data bettween forms using text boxes and list boxes

Hey guys, I am having trouble effectively transferring data between forms. So I have my entry form. It has one button: private void addBtn_Click(object sender, EventArgs e) { string data = string.Format("{0} \t {1} \t {2} \t {3} \t {4} \t {5}", fnameTxtBox.Text, lnameTxtBox.Text, ce...

Spanning a Listbox in the WPF grid based on a condition

I was wondering how to increase the span of a listbox control for a certain criteria in WPF Grid. I have a textbox wherein the user enters a string and based on the presence of the string in a collection, the listbox should become visible and show the results in it by spanning across the columns of the grid. This listbox is actually a pa...

Raising a error when trying to save a empty listbox

When the user clicks save, and there is nothing in the listbox, i want to raise an error. I figure I use a try catch block like so: try { //when you go to save, and the list box is empty, you should get an error message if (dataListBox.Items.Equals(null)) throw new Exception(); ...

WPF - Binding large amount of data in Listbox

Hi All, I am creating a search page for books. There are lacks of data in the database. If the data size is more than 2000 the application is getting hanged. ItemsSource of the listbox having the data but something wrong is happening behind. Code <ListBox Grid.Column="1" x:Name="lbResult" ItemsSource="{Binding}" SelectionChanged="lb...

Raising an exception when trying to see if a item is selected in a listbox

hey guy, have onather problem. I am trying to raise an exception if a user clicks the delete button but doesnt select a item in the listbox. This is what i have: try { if (dataListBox.SelectedIndex == null) throw new Exception; //deletes selected items dataListBox.It...

Use Radial Panel in Listbox, throwing exception VisualTree Single Element

Hi Guys, I have a very simple radial panel with a few dependency properties like so: public static readonly DependencyProperty RadiusProperty = DependencyProperty.Register("Radius", typeof(double), typeof(CircularPanel), new PropertyMetadata(50.0, new PropertyChangedCallback(RadiusChanged))); private static void RadiusChanged(Dependen...

WPF - Controls inside the Listbox

Hi All, i am displaying images inside the list box. If the image URL doesn't have image means it will display textblock with Book title and Author name. Problem: If the image is available i want to hide the textblock. Code: <local:ImageConverter x:Key="myImageConverter"/> <Style x:Key="ListBoxItemStyle" TargetType="{x:Type Lis...

Is there a way to right-align a numeric column in a ListBox

We have a standard Access listbox with multiple columns. Is there a way to have integer or currency columns right aligned? ...

WPF - Control Template and control visibility based on data

Hi All, Hi I am using Control template to display listbox items. I want to set the visibility of the control based on the item value. I need the same http://efreedom.com/Question/1-424562/Can-Replace-Image-WPF-Grid-Another-Control-Depending-Source-Data How to include this option in my code. (If the image source [ImgUrl] value is null ...

Dynamically populate a listbox from a textbox in ASP.NET MVC 2

Here's what i'm trying to do: 1 textbox with an Add button, and a ListBox underneath with a Delete button, along with a bunch of other fields. You can probably guess the functionality: type something in the text box and click Add, it will add that string into the listbox below. Select an item in the listbox and hit Delete, the item is ...

Tooltip on Listbox display strange behavior

Hey all, I'm brand new to C# and I wanted to enabled tooltips on a listbox. My wish was to be able to display a different tooltip depending on the hovered item in the listbox (the standard listbox's behavior is to display one single tooltip for itself no matter what item is hovered)... I managed to write the following code : private v...

Problem with ListBoxItem - produce "System.Windows.Data Error: 4"

Hi. I have craeted the fallowing ListBox: <ListBox x:Name="RecentItemsListBox" Grid.Row="1" BorderThickness="0" Margin="2,0,0,0" SelectionChanged="RecentItemsListBox_SelectionChanged"> <ListBox.Resources> <Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource {x:Type ListBoxItem}}"> <Style.Trig...

WPF ListBox - Scroll always on top

I have a ListBox that displays some words. Words are entered in TextBox, and when submitted on button click, they are added to ListBox. The problem is, if I add many words, scroll is always on top of ListBox, so I don't see last but first words added. Is there a way to dynamically move scroll to the end of ListBox every time word is adde...

Get reference to my WPF ListBox's ScrollViewer in C#?

I think this should be easy but I'm having a tough time with it. How can I get a reference to my ListBox's scrollviewer in C#? I've tried pretty much everything I can think of. The ListBox is in a WPF Custom Control so we use Template.FindName to get references to all our controls. My ListBox looks like this: <ListBox x:Name="PART_Sou...

Select action from listbox, perform it on ticked values in GWT

Hi, This is my working code. What I was thinking of doing, is to add a few check boxes, and select an option from the List box. That option is applied to the ticked values, after clicking the apply button, preferably an async call. is that possible? I tried a few things like setting a listener for the button and then trying to get the ti...

WPF bindings not refreshing

I have a listbox on my form that looks like this: <ListBox Name="lbResults" SelectionChanged="lbResults_SelectionChanged"/> I am binding the following collection to it: ObservableCollection<Hand> oHands = new ObservableCollection<Hand>(); using the following code: lbResults.DataContext = oHands; Binding binding = new Binding(); lb...

Delphi TListBox contents overflow when selecting (Win7, 32bit, themed)

I've a TListBox on a Windows form with 966 elements in it. When I click a button on my form, a subset of these strings are selected (roughly 200 of them). If I now unfocus my application by clicking somewhere on the task bar, the entries from my TListBox bleed upward, so as they are visible above the boundaries of the TListBox. They a...

C#: System.Windows.Forms.ListBox not grabbing focus.

I'm popping up a ListBox over a TextBox. I set ListBox.Parent to be the DataGrdiView that houses the TextBox (which is the edit control for a DataGridViewCell). I add string items to ListBox.Items, then I set ListBox.Location, ListBox.Width, ListBox.Height, and ListBox.Visible (to true). All of that works fine. But I can't set focus ...

Horizontal scroll for listbox

I am having an html listbox with a lengthy content. The width of the content is also too long that horizontal scroll bar is a necessity. Unfortunately horizontal scroll bar is not there in listbox. How can get both horizontal and vertical scroll for the listbox. I have given a div as a parent to this html listbox and gave overflow-x: au...