listbox

How to capture a mouse click on an Item in a ListBox in WPF?

Hi ! I want to get notified when an item in a ListBox gets clicked by the mouse, whether it is already selected or not. I searched and found this: (http://kevin-berridge.blogspot.com/2008/06/wpf-listboxitem-double-click.html see the comments) private void AddDoubleClickEventStyle(ListBox listBox, MouseButtonEventHandler mouseButtonEve...

How to list text files in the selected directory in a listbox?

How can I list the text files in a certain directory (C:\Users\Ece\Documents\Testings) in a listbox of a WinForm(Windows application)? ...

How to get the file info which is selected in a listBox?

I have a Windows application that takes the data in the textboxes and writes them into a randomly generated text file, kinda keeping logs. Then there is this listbox that lists all these separate log files. The thing I want to do is to have another listbox display the file info of the selected one, the 2nd, 7th, 12th, ..., (2+5n)th lines...

How can I sort a ListBox using pure xaml and no code behind?

I need to sort the strings in a ListBox, but it is bound to the view model by another component via the DataContext. So I can't directly instantiate the view model in xaml, as in this example, which uses the ObjectDataProvider: http://www.galasoft.ch/mydotnet/articles/article-2007081301.aspx in my xaml: <ListBox ItemsSource="{Binding ...

How to add typeahead search to WinForms ListBox (or ComboBox)?

In .Net 2.0, the WinForms ListBox and ComboBox controls allow you to search through the list by pressing the first letter of the list item on the keyboard. Subsequence presses of that key will cycle through the list items starting with that letter. A browser like FireFox on the other hand lets you "typeahead" search for items in a list...

WPF ListBox that lays out its items horizontally

I'm trying to write a WPF application for displaying images from a selection. I want to display all of the available images in a banner along the top of the window, and display the main selected image in the main window for further processing. If I wanted the list on the Left of the window, displaying the images vertically, I can do thi...

WPF ListBox expand selected item

I have the following code snippet (copy and paste into kaxaml, xamlpad, etc to try it) that collapses all but the selected item. However, I want to revert back to all visible when the mouse is not over the ListBox and I just cannot get it to work short of going code behind. I am using the IsMouseOver ListBox property to set selected item...

Using an ObjectCollection as a parameter create a new Control?

I was using something like public int Test(System.Windows.Forms.ListBox.ObjectCollection Colecction) { } With this I want to pass just the ObjectCollection of the control, to sort, add and delete elements without passing the entire control, but someone told me that, this way of calling the collection, actualy, create an entire ListBox,...

WPF, XAML: How to style a ListBoxItem using binding on property of ListBox ItemsSource object?

I have a ListBox which is bound to ObservableCollection of LogMessages. public ObservableCollection<LogMessage> LogMessages { get; set; } public LogMessageData() { this.LogMessages = new ObservableCollection<LogMessage>(); } Each Message has two parameters: public class LogMessage { public string Msg {...

Adding an item to a bound WPF ListBox

Ok, this has been a head scratcher for me. I have a ListBox I am binding to a linq query like so: private IQueryable<Feed> _feeds; public IQueryable<Feed> Feeds { get { if (_feeds == null) { var feedsQuery = from f in _db.Feed orderby f.Title select f; ...

How to insert data in listbox control in ASP from database row by row

i had 7 columns in my tabel and i want to display all the data in list box one after another not in a single line with where clause condition "where name = @nameTextBox" where nameTextBox is a TextBox on the same page Example Joe Inc = this is the value of Text Box Joe 12 gold Street Pincode 10010 PHone-+121212 this is the type of f...

C# ListBox DrawItem HotLight State in the OwnerDraw mode ?

Hello, i'm using OwnerDrawFixed as a DrawMode for the custom ListBox control in my WinForms app. I want to repaint the background (or do some other action) of the ListBoxItem when the user hovers over the listbox item, that is, at the MouseMove... DrawItemState.HotLight never works for the ListBox, so i wonder how to emulate it, how to...

How to load large amounts of data in a ListBox? ASP.NET MVC application

I am working with an ASP.NET MVC application. There is a requirement that a user be able to select an item from a ListBox that could contain over 30,000 entries. Is there a dynamic way to populate the contents of this ListBox using an Ajax call - that would perform well? Would I be better off just populating the ListBox control on th...

Get a WPF ListBox item from MouseLeftButtonDown

I want to run some code when the user single clicks on any given ListBox item. My setup is a ListBox with a custom ItemsPanelTemplate (Pavan's ElementFlow). Based on the position data that comes in to MouseLeftButtonDown is there a way to tell which item is was clicked? This is made a bit more difficult (or more confusing) by the cust...

Is there an ASP.NET collection for selected items in ListBox?

On my Asp.NET website, I have a listbox that allows multiple selections. I'd like to be able to ask something like: blah = myListbox.selectedItems; and be given a collection of the items that were selected in the listbox. It looks like there is a method for this in the Windows Forms world, but not for asp.NET. Is there a simpler wa...

I have to display a list of tracks GROUPED BY Album in WPF

Now I am aware that I probably need to use a ListBox and can use the GroupStyle stuff which completely 100% fits my needs. Only thing is that I've been told that: "Whenever a "GroupStyle" is set on the control, the panel that layouts the items changes from VirtualizingStackPanel to StackPanel (this is a hack in MS code)..." I will nee...

Silverlight 3 - ListBox : how to achieve Smooth Scroll and catch MouseDown/MouseUp events

I'm trying to adapt the behaviour of the ListBox for my needs and I ran into several problems 1) How can you programatically set the scrolling position of the ListBox The ListBox does not provide an accessor to its inner ScrollViewer so that you cannot scroll it to wherever you want. 2) How to accurately set the vertical scrolling (i.e...

What's the correct way to use controls in Owner drawn list box

I am experimenting with owner drawn list box. I am adding a text box to a specific item within list box. However, when I start scrolling, the text box does not display in the right location. What is the right way to do this? Here's the code I am using. Form1.cs using System; using System.Collections.Generic; using System.ComponentModel...

listbox scrolling

I want to disable scrolling ( not hide the scroll bar but disallow scrolling altogether) when the user selects certain items in my listbox if the user moves to a differnet item ( the criterai are not important ) then I want to re-enable scrolling How can I do this in .NET 2.0 ...

How can I set exact height of listbox in winforms (C#)?

Hello, I've been having some difficulties with setting height of listbox. Code like this... listbox1.Height = some_number; ... works only for some numbers. It seems that height of listbox may be only multiplication of height of its element. Is there a way how to "override" this behaviour? Thank you for help! ...