Questions tagged [itemscontrol]

Represents a control that can be used to present a collection of items.

An ItemsControl is a type of WPF Control that can contain multiple items, such as strings, objects, or other elements.

1155 questions
135
votes
3 answers

WPF: ItemsControl with scrollbar (ScrollViewer)

I followed this small "tutorial" on how to add a scrollbar to an ItemsControl, and it works in Designer view, but not when I compile and execute the program (only the first few items show up, and no scrollbar to view more - even when…
Xuntar
  • 2,080
  • 3
  • 18
  • 30
127
votes
3 answers

Virtualizing an ItemsControl?

I have an ItemsControl containing a list of data that I would like to virtualize, however VirtualizingStackPanel.IsVirtualizing="True" does not seem to work with an ItemsControl. Is this really the case or is there another way of doing this that I…
Rachel
  • 122,023
  • 59
  • 287
  • 465
80
votes
1 answer

Setting Canvas properties in an ItemsControl DataTemplate

I'm trying to databind to this ItemsControl:
atsjoo
  • 2,262
  • 3
  • 19
  • 22
77
votes
7 answers

How to get a List collection of values from app.config in WPF?

The following example fills the ItemsControl with a List of BackupDirectories which I get from code. How can I change this so that I get the same information from the app.config file? XAML:
Edward Tanguay
  • 176,854
  • 291
  • 683
  • 1,015
64
votes
5 answers

How can a separator be added between items in an ItemsControl

I'm needing to display a list of numbers from a collection in an Items Control. So the items are: "1", "2", "3". When they are rendered, I need them separated by a comma (or something similar). So the above 3 items would look like this: "1, 2,…
Nathan
  • 1,551
  • 4
  • 16
  • 21
56
votes
16 answers

How to programmatically select an item in a WPF TreeView?

How is it possible to programmatically select an item in a WPF TreeView? The ItemsControl model seems to prevent it.
Thomas Bratt
  • 40,822
  • 34
  • 113
  • 133
38
votes
3 answers

WPF: Alternating colors on a ItemsControl?

How do I get alternating colors on a ItemsControl? I have AlternationCount set to 2, but the ItemsControl.AlternationIndex property always returns 0.
Jonathan Allen
  • 63,625
  • 65
  • 234
  • 426
38
votes
3 answers

WrapPanel as ItemPanel for ItemsControl

Still fooling around with WPF and learning as I go. Trying now to build a dynamic grouping of controls (mostly Buttons but might include CheckBoxes and others). I had no idea what was the best way to do this so I tried creating a ItemsControl style…
Ingó Vals
  • 4,468
  • 14
  • 57
  • 108
38
votes
3 answers

What exactly does Panel.IsItemsHost do?

What does the Panel.IstItemsHost attached property used for? I see plenty of examples of people setting it on the ItemsContainer template for an ItemsControl, but the un-documentation over at MSDN does not explain why or what advantages setting…
Armentage
  • 8,994
  • 6
  • 30
  • 33
35
votes
1 answer

WPF Dynamic Layout with ItemsControl and Grid

I am creating a WPF form. One of the requirements is that it have a sector-based layout so that a control can be explicitly placed in one of the sectors/cells. I have created a tic-tac-toe example below to convey my problem: There are two types and…
Jason Williams
  • 1,223
  • 2
  • 11
  • 27
35
votes
4 answers

How do I access the children of an ItemsControl?

If i have a component derived from ItemsControl, can I access a collection of it's children so that I can loop through them to perform certain actions? I can't seem to find any easy way at the moment.
James Hay
  • 12,139
  • 8
  • 42
  • 63
32
votes
5 answers

How to use AlternationIndex in ItemsControls?

I have seen some articles that show how to use AlternationIndex with ListBoxes or ListViews, but I had spent a few hours trying to get alternating background colors on the base ItemsControl class and nothing seems to work. All ListBox samples I saw…
Filip Skakun
  • 31,347
  • 6
  • 71
  • 99
27
votes
2 answers

How can I get a WPF Window to expand to fit the contents of a dynamically changing ItemsControl?

I've got a WPF application which starts off with a very small window. Something in the area of 200x100. When certain events are raised from an external source, I add a control to the ItemsControl area of my window. The items control is currently set…
Josh Smeaton
  • 43,953
  • 24
  • 121
  • 160
26
votes
5 answers

Finding control within WPF itemscontrol

Hi i have few a single textbox within the the datatemplate for itemscontrol. When i bind the itemcontrols to a observable collection i get two text boxes. But i need to do some manipulations based on each of the text boxes for which i want to find…
deepak
  • 823
  • 3
  • 15
  • 19
26
votes
5 answers

How to get the index of the current ItemsControl item?

Is there any way to get the index of the current ItemsControl item in WPF? For example, I want to do something like:
herohuyongtao
  • 45,575
  • 23
  • 118
  • 159
1
2 3
76 77