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
25
votes
4 answers

How do I get find my "CheckBox" item that is in the ItemTemplate?

I have the following (very simple) ItemsControl:
Timothy Khouri
  • 29,873
  • 18
  • 80
  • 125
24
votes
3 answers

WPF - Bind to Item Index from within ItemTemplate of ItemsControl?

Is there a way to bind to the ItemIndex from within the ItemTemplate of an ItemsControl? For example:
Rachel
  • 122,023
  • 59
  • 287
  • 465
24
votes
1 answer

Bind to ItemsControl's DataContext from inside an ItemTemplate

I have an ItemsControl whose for the ItemTemplate DataTemplate contains a Button. I want the Command on the button to bind to a Command on the DataContext of the ItemsControl, not the ItemTemplate. I think the solution has to do with using…
Mark Heath
  • 45,254
  • 26
  • 128
  • 188
24
votes
3 answers

How do I do bindings in ItemContainerStyle in WinRT?

I'm trying to bind a collection to an ItemsControl, with a Canvas as the items panel, and with each item's Canvas.Left and Top bound to properties on the item objects. Basically I'm trying to re-create the 2-D databinding I described in this post on…
Joe White
  • 87,312
  • 52
  • 206
  • 320
22
votes
3 answers

Stretching controls to fill ItemsControl

I am attempting to write a simple WPF learning project which creates a set of buttons inside a resizeable main window. There is to be one Button per entry in a collection, and the contents of that collection may vary during run-time. I want the…
Gregyski
  • 1,677
  • 2
  • 18
  • 25
22
votes
5 answers

How to draw line of ten thousands of points with WPF within 0.5 second?

I am writing WPF code to show a real-time plot which is a connected line containing about 10,000 points. It takes about 5 seconds to show a picture in my computer. Does anyone have an idea to make it quicker and within 0.5 second? class eee :…
Yao
21
votes
4 answers

Use different template for last item in a WPF itemscontrol

I'm using a custom template in my itemscontrol to display the following result: item 1, item 2, item3, I want to change the template of the last item so the result becomes: item 1, item2, item3 The ItemsControl:
Bram W.
  • 1,419
  • 4
  • 14
  • 37
21
votes
2 answers

Specify ControlTemplate for ItemsControl.ItemContainerStyle

The following is similar to what I'm trying to accomplish. However, I get the error Invalid PropertyDescriptor value. on the Template Setter. I suspect it's because I didn't specify a TargetType for the Style; however, I don't know the…
Travis Heseman
  • 10,909
  • 8
  • 34
  • 46
20
votes
4 answers

How to make WPF wrappanel child items to stretch?

I'd like to create an ItemsControl where child items are placed like a WrapPanel, but child Items should take as much space as it can. So that when the window size gets larger or smaller, the child items should stretch according to a certain…
Yeonho
  • 3,384
  • 4
  • 35
  • 58
20
votes
2 answers

ItemsControl, ItemsPanel and ItemsPresenter (Silverlight, XAML)

I'm utterly confused by these 3 terms, when to use which? What's the relationship and they are children of which controls? Is it correct to say this is the tree: ItemsControl > ItemsPresenter > ItemsPanel
bcm
  • 5,320
  • 9
  • 55
  • 90
20
votes
2 answers

How to setup a grid as template for an Items control?

I'm trying to create an ItemsControl that uses a grid as its ItemsPanel in such a way that it has two columns, where the first columns width is the width of the widest item in that column, and has as may rows needed to display all the…
pastillman
  • 984
  • 1
  • 12
  • 24
17
votes
3 answers

WPF Databound Bulleted List

How do I create a databound, bulleted list of hyperlinks in WPF? I've got this:
Christopher
  • 217
  • 2
  • 7
17
votes
2 answers

WPF - UserControl default Content attribute

I'm creating a UserControl and I just can't remember the name of the attribute which you use to decorate the property which you want to act as the default content property. To give a concrete example, say i have a property called 'Title' which i…
EightyOne Unite
  • 11,141
  • 12
  • 73
  • 102
17
votes
5 answers

WPF ItemsControl the current ListItem Index in the ItemsSource

Is it possible to know the current item's Index in a ItemsControl? EDIT This works! One Two
Jerry Nixon
  • 29,446
  • 13
  • 110
  • 219
17
votes
2 answers

Item spacing in WPF ItemsControl

I'm displaying a List collection in an ItemsControl. The problem is that there is no spacing between the list items such as TheyAreAllNextToEachOther. How can I create some spacing between the items?
Denys Wessels
  • 16,209
  • 14
  • 72
  • 115
1
2
3
76 77