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.

1200 questions
27
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
  • 1,104
  • 2
  • 16
  • 27
27
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
  • 48,273
  • 29
  • 137
  • 194
26
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
  • 31,315
  • 21
  • 88
  • 128
24
votes
5 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,587
  • 4
  • 16
  • 39
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
  • 130,264
  • 66
  • 304
  • 490
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
  • 94,807
  • 60
  • 220
  • 330
23
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,629
  • 4
  • 39
  • 61
22
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,470
  • 10
  • 59
  • 92
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,707
  • 3
  • 18
  • 26
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
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
  • 11,359
  • 8
  • 37
  • 46
18
votes
3 answers

WPF Databound Bulleted List

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

How do I bind a List to an ItemsControl?

In my presenter I have this property: public List PropertyNames { get; set; } And I want to list out the names with a ItemsControl/DataTemplate like this:
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
17
votes
3 answers

How-to define Empty DataTemplate for the ItemsControl based controls like ListView or DataGrid

ASP.NET controls like ListView allows providing a custom template by setting the ListView.EmptyDataTemplate property, this template will be rendered in case of empty data source. How to do the same in WPF (XAML only preferrable) for ItemsControl…
sll
  • 61,540
  • 22
  • 104
  • 156
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,665
  • 14
  • 79
  • 105
1
2
3
79 80