listbox

Silverlight 4 and LisBox's SelectedItem when using DataTemplate as ItemTemplate

Hi All, I'm using tow listboxes for drag n drop where user can drag items from source listbox and drop on the target. I'm using a DataTemplate for the ListBoxItems of my ListBox Controls. I need to give the user ability to move up/down items in the target listbox after they been moved from source. I have two button "Move Up" & "Move ...

Silverlight ListBox Height Automatically increase

Hi all, I am using silvelight listbox control,and i stucked.Every listbox item contains another listbox item now when i bind my data second listbox control,it appears horizontal scrollbar and this is not a problem i can remove it.How can do when I add new Item to second listbox,its height automatically increase? For a second listbox Hei...

Different views on items in listbox based on content

I have a list of items with the an interface like this public interface INamedItem { string DisplayName { get; } } In silverlight, I can bind to a listbox and show the display name, and that works. However, depending on the value of DisplayName, I want to show it differently (use a different DataTemplate?). If Di...

ContextMenu on ListBox Item with DataTemplate

I have a ListBox with different classes of items. DataTemplates are used to present those objects in the appropriate way. I want to have different context menus in the DataTemplates of these classes. Everything works fine using the mouse, but using the keyboard I can't bring up the context menu. This is probably because the keyboard-fo...

Self Sorting Listbox

Totally stumped by something that seems easy, and has been done to death... Yet still stumped. What I want to do: I've got a WinForms ListBox. Its items are populated with objects, the DisplayMember is set. As the app runs, the data in the listed items might change, including the field behind the DisplayMember. I want the text disp...

How to check when silverlight Listbox is updated

How do I check when a listbox is updated, or when its item count changes? I can only capture the SelectionChanged event now. I'm trying to select any new item when initially added to the listbox binded DocItemCollection. ...

Stretch ListBoxItem Style Problems

I have a problem stretching the content of a ListBoxItem. I use a DataTemplate with a Grid to place the content of the last column aligned at the right. But I must have something in the basic style of the controls that prevents this kind of display - the "*" ("consume all the rest of space") displays like "auto" ("take only what you real...

wpf - ListBox - bind SelectedItem to an xml attribute?

I have a listbox on a usercontrol which is populated by a xml file. <Machines xmlns=""> <Machine Name="Prod1" IP="192.168.1.200" isDefault="true" InstanceName="sql08" /> <Machine Name="Prod2" IP="192.168.1.101" /> <Machine Name="Test1" IP="192.168.1.103" /> <Machine Name="Test2" IP="192.168.1.104" /> </Machines> I would like t...

Constraining item heights in WPF ListBox, with indicator

I have a ListBox control in WPF which contains items of variable height (predominantly a large text block, so it's also affected by word wrapping). Since scrolling behaves badly when the height of an individual item gets too high (especially when close to the height of the ListBox itself), I want to constrain the max height of the indiv...

ASP.NET listbox MaintainScrollPositionOnPostBack re-ordering items near bottom reloads listbox at top

I've got an ASP.NET (VB) page with two listboxes. Standard stuff - select an item on left, hit add button and it moves to right, etc. I've also got two buttons to move items up or down in the resulting list. My problem is that if I go to the 2nd to the last item (or any in that range) and move it down in the list the list resets the s...

WPF drag and drop from a ListBox that has SelectionMode=Extended

I have a ListBox and want the selection-mode to be extended. Also I want have to implement drag and drop functionality. The problem now is, that if the mouse is clicked on a selected item, it will be immediately be selected as single selection instead of waiting to the mouse-up-event for doing this. Due to this behaviour, start dragging...

How to color lines in a listbox?

Hy! I would like to make a logging system with a listbox, that highlights some of my lines, depends on my will :P So, if I have 4 kind of reporting, like, general, warning, error, debug. I add with somelistbox.Items.Add("Starting"); <-- I would like to drawn this as grey somelistbox.Items.Add("Error!"); <-- I would like to d...

WPF Disable the item selection on MouseMove of a ListBox

If I press the mouse on an item of a ListBox and then move the mouse without releasing the mouse-button over another item, the selection automatically changes to the element that is under the mouse. Is there a possibility to disable this behaviour, so that the selection is only changed when the mouse has been pressed directly over the ...

Determine the width of the widest element in a ListBox

When you do not explicitly set the width of a ListBox, it will automatically set its width to the width of its widest visible item. This means that as you scroll up and down and the widest visible data item changes, the width of the listbox itself increases and decreases. So what is the best way to find the width of the widest item in t...

C# sort Listbox, add to a sorted list

Hi, I want to sort the elements in C# listbox by some field in the object element. Is there a method in C# that perform this task? Maybe a function that receives a comparison function as a parameter or something like that? another thing, when the listbox is sorted I want to add an element to a sorted list. is there such a method? than...

Best Way To Span Multiple Columns in WPF Grid/List?

I have a custom user control I wrote in WPF to display some data. I want to show this usercontrol in a list, but I also want to provide multiple column headers (matching some properties on the user cotrol) so users can sort on properties contained in the usercontrol. I am not sure the best way to go about this. I currently have a Lis...

Enhance ItemsControl or tweak ListBox Selection

I have a number of items which I wish to be contained in either a ListBox or an ItemsControl. The size of the control is fixed, but the size of its contents are not. It is possible for this control to have 13 items inside, but if the user wishes, only one is displayed at a time, and takes up the entirety of the available space. Two items...

Events button is not visible in Visual studio 2008

I have a list box in an WPF application. Its properties is visible in Visual studio Properties panel. The icon for events('lightning') is missing. How can I see the events connected to listbox. ...

WPF: complex tab focus behavior

Guys, What's up :-) Need your help. My control is constructed from nested list boxes and tree views. Each list box / tree view item also contains rich text boxes and other controls. I want to define a 'tab' focus behavior such that when the user clicks 'Tab' the next focusable item (according to an order i define) will become focused...

WPF Listbox with images - how to detect if an image didn't download

I have a wpf ListBox, and each item has an image that the list needs to download from a server - the list definition looks like so: <ListBox x:Name="List" BorderThickness="0" AlternationCount="2" ItemContainerStyle="{StaticResource alternatingWithBinding}" HorizontalContentAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisib...