listbox

Accessing a WPF GroupItem text for conversion in a template

I'm customising the appearance of grouping in a ListBox. In ListBox.Resources, I have declared something like (formatting removed): <Style TargetType="{x:Type GroupItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type GroupItem}"> <StackPanel Orientation="Vertical"> <!-- ...

If more than X items are selected in a ListBox, revert to the previous selection

I have a text box where I want to limit the number of selected items to MaxSelection. The desired behaviour is that once MaxSelection items are selected any futher selections are ignored. (Thus this question is different from "limit selections in a listbox in vb.net"). I have an event handler for the SelectedIndexChanged event for the...

How can I make my Windows Form to do and display my database query?

I have 3 Tables: Titles: TitleId (int 6, primary key) TitleName (varchar 50) Authors: AuthorId (int 6, primary key) AuthorName (varchar 50) AuthorsTitles (this is a junction table for Titles and Authors) TitleId (int 6) AuthorId (int 6) There's a "many to many" relation: A Title may have many Authors, and an Author may ha...

Silverlight MVVM ListBoxItem IsSelected

I have a collection of ViewModels bound to a ListBox. I am trying to bind the IsSelected properties of each together. In WPF it works by setting the style: <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="IsSelected" Value="{Binding Path=IsSelected, Mode=TwoWay}" /> </Style> This does not work in Silverlight. How can I...

.NET Multi-Select Listbox - How to get Item just selected ?

In .NET there doesn't seem to be a property to find the item just selected in a multi-select listbox; SelectedIndex always shows the first selected item. From memory VB6 had the ListIndex property that changed accordingly... Why remove a useful property ?! Duplicate: How to get the last selected item in multiselect ListBox? ...

Using multiple listboxes in python tkinter

from Tkinter import * master = Tk() listbox = Listbox(master) listbox.pack() listbox.insert(END, "a list entry") for item in ["one", "two", "three", "four"]: listbox.insert(END, item) listbox2 = Listbox(master) listbox2.pack() listbox2.insert(END, "a list entry") for item in ["one", "two", "three", "four"]: listbox2.insert...

WPF Listbox Image binding question (again)!

This is killing me, I can't get an image to display as a list box item: here is my code: WPF: // listbox called lstWidgets <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Name="txtTitle" Margin="2,5,5,2" Text="{Binding name}" /> <Image Name="imgDisp" Source="{Binding img}" Width="50" Height="50"/> ...

C# Listbox Bound to Entity "Entity Framework"

On my WinForm, I bound my listbox to a Table in Entity on EDMX, but when the table data is changed, I tried to call myListBox.DataSource = Entities.table; myListBox.ResetBindings(); myListBox.Refresh(); but nothing happens in ListBox. The Entities.table object holds the right data though, it just doesn't reflect on the ListBox. Any ...

WPF ListBoxItems with DataTemplates - How do I reference the CLR Object bound to ListBoxItem from within the DataTemplate?

I have a ListBox, that's bound to an ObservableCollection. Each ListBoxItem is displayed with a DataTemplate. I have a button in my DataTemplate, that when clicked, needs a reference to the member of the ObservableCollection it's part of the DataTemplate for. I can't use the ListBox.SelectedItem property because the item does not become...

Image Preview in a Listbox

Hi How can I display a preview (almost like a hint) of an image when I hover the mouse over an item in a listbox of filenames? I've tried showing a form and loading the image, but when the preview form shows, I lose focus for the listbox which means that when I move the mouse, the preview image does not change when I go to the next item...

can i treat a flowlayoutpanel like a listbox

is there ways to have a selecteditem and detect when it changes. what is the recommended best practices for wanting to have listbox type behavior but i dont have strings, i have user controls that i want to list from top to bottom. is flowlayoutpanel the correct way to do this or is there any other way that gives me the listbox behavio...

.NET Compact framework (C#) : Add checkbox to Listbox

Hi, I would like to add a checkbox control to a listbox control. The listbox has to contain A couple of tasks, and I have to check if a tasks has been opened before. I have a code sample, but it adds the checkbox as an object, not as a control while (reader.Read()) { CheckBox c = new CheckBox().Enabled = fal...

Winforms listbox not updating when bound data changes

The image below shows how my code works. When I press button2 the listbox is updated, but not when I press button1. Why? Is the problem threading related? If it is, where should I add the call to (Begin)Invoke? One interesting thing to note is that if I first press button1 and then button2 the data generated by the button1 click is s...

Setting Focus on new Items in Items Control

I've got a ListBox which is getting new items added to it through Databinding (i.e. something is getting added to the list and the box is updating to include the new item). The items in the list box are editable data templates, so the question is: How do I set the focus to the first field in the template when a new item is added? I've ...

Scrolling between DataTemplates in ListBox on a timer

I'm working on a project right now in which I need to automate animated scrolling for DataTemplates displayed in ListBoxes throughout the application. Basically something common in Javascript like this Javascript smooth scrolling example that runs on a timer. I've seen a few other people around posting similar questions like this one bu...

[WPF] Reapplying template for ListBox item programatically

Basically, I have a list of colors and a defined datatemplate for listbox item: <DataTemplate x:Key="colorItemDataTemplate"> <Border x:Name="borderInner" BorderBrush="Black" BorderThickness="1" Background="{Binding Brush}" Width="11" Height="11" /> </DataTemplate> Now, when I add a bunch of items into the listbox and then set the ...

.Net\AJAX Listbox and updatepanel problem

I have a listbox(l1) in an updatePanel that gets populated on changing a drop-down which is in the updatepannel as well. I have another listbox(l2) in the updatepanel which can populate l1 via javascript. I have 2 two items in dropdown. Item 1 has 6 items releated to it and Item 2 has none. When the page loads Item 1 is selected in t...

ListBox Hyperlinks--Invoking ICommands

This is similar to a question I asked a couple of days ago. However, I now have a better understanding of the problem, so I'd like to take another crack at it. I am creating an MVVM app that (among other things) displays a list box with alerts for the user. These alerts relate to various routine tasks that have to be carried out periodi...

WPF access controls in a DataTemplate of a ListBox

I'm building a WPF order manager app and i've run into a situation i'm not sure how to deal with. I want to re-bind the list of purchase orders requests for each order but i only want to do it if the the purchase order requests panel is visible in the app (they double click the order to show the list of purchase order requests). The pro...

What do you call this user interface control?

What do you call this interface control. You have 2 lists, one of the lists acts as your pool and the other as your current values. Tends to look like this [1 ] [1 ] [2 ] Add>> [2 ] [3 ] Add All>> [ ] [4 ] <Remove [ ] [5 ] <<Remove All [ ] [6 ] [ ...