Questions tagged [itemtemplate]

A WPF/Xaml DataTemplate used to display each item in an ItemsControl.

A WPF/Xaml DataTemplate used to display each item in an ItemsControl.

555 questions
10
votes
5 answers

If statement in repeaters ItemTemplate

I'm using an ASP.NET Repeater to display the contents of a . It looks something like this:
Vivendi
  • 20,047
  • 25
  • 121
  • 196
10
votes
2 answers

Using ItemTemplate for a TreeView when adding items in code

I'm adding TreeViewItems manually in code behind and would like to use a DataTemplate to display them but can't figure out how to. I'm hoping to do something like this but the items are displayed as empty headers. What am I doing wrong? XAML
Wallstreet Programmer
  • 9,567
  • 3
  • 37
  • 52
9
votes
1 answer

WPF: Changing a ComboBox's ItemTemplate removes the ability to jump down the list as you type. Any way to fix this?

PersonVM.cs public class MainWindowVM { public MainWindowVM() { PersonList = new ObservableCollection(Employees); } private Person[] Employees = new Person[] { new Person { ID = 1, Name = "Adam" }, …
myermian
  • 31,823
  • 24
  • 123
  • 215
9
votes
2 answers

How do I set ItemTemplate dynamically in WPF?

Using WPF, I have a TreeView control that I want to set its ItemTemplate dynamically through procedural code. How do I do this? I assume I need to find the resource somewhere. myTreeViewControl.ItemTemplate = ??
ScottG
  • 10,711
  • 25
  • 82
  • 111
9
votes
5 answers

Disable MouseWheel in editable ComboBox as ItemTemplate

I use a ComboBox as ItemTemplate inside a ListBox. My ComboBox is editable. When the user use the mouse wheel in the combobox, it change the current value. I don't want that. I want the ListBox to scroll. Is there any solution to this ? Most…
droopy6
  • 191
  • 1
  • 6
9
votes
2 answers

Difference between Templates

What is the difference between ControlTemplate DataTemplate HierarchalDataTemplate ItemTemplate
user1688603
  • 121
  • 1
  • 3
9
votes
3 answers

Change style of last item in ListBox

I have listbox control which has list of colors. Here is code and Image:
user1535848
  • 149
  • 1
  • 2
  • 9
7
votes
1 answer

Visual Studio 2019 Item Template only showing up for certain types of projects

I have created and imported an Item Template, a C# class template for use in Visual Studio. When I open a C# Class Library project I can create a new item from this template with Add > Class > UniqueIdentifier. This works as expected. When I open an…
7
votes
2 answers

Wrap something around each item in an ItemsControl

Let's say I have a collection of objects of different classes. Each class has its UserControl DataTemplated in a resource file. Now I want to use ItemsControl to display the collection, but I want an Border or Expander around each item. I would…
Guge
  • 4,569
  • 4
  • 35
  • 47
7
votes
1 answer

String was not recognized as a valid Boolean when added to visible attribute

I'm trying to add a true or false Visible attribute to my listview itemtemplate table. What I did is that I have a hiddenfield that is set at page load so that I can make a specific column visible or not. This is my hiddenfield and column: Hidden…
marchemike
  • 3,179
  • 13
  • 53
  • 96
7
votes
1 answer

WPF: Adding an image to a ListBox ItemTemplate

I am creating a WPF app with a list box that I am binding to project names. As a decorative element, I want to place a small icon next to each item in the list, similar to the way Outlook does in its Personal Folders list. For starters, I am going…
David Veeneman
  • 18,912
  • 32
  • 122
  • 187
6
votes
1 answer

Binding a nested ListBox to a nested List?

I have the following ViewModel-Property: public List> Names .... //It's a dependency property In my view I would like an ItemsControl that has an ItemsControl:
WaltiD
  • 1,932
  • 2
  • 23
  • 25
6
votes
2 answers

How to group ListBoxItems by first letter in WPF using XAML?

First, here is the previous post that deals with the ListBox AccountListBox data binding to my ObservableCollection Accounts from the AccountsCollection.cs class. So now I have a binding object AccountsCollection and a DataTemplate named…
Boris
  • 9,986
  • 34
  • 110
  • 147
6
votes
3 answers

How to get element in code behind from DataTemplate

I have a FlipView control with the DataTemplate defined as below:
tavier
  • 1,744
  • 4
  • 24
  • 53
5
votes
2 answers

WPF Programmatically create treeview itemtemplate/columns

I have an application that reads database tables and puts it into a treeview. The current ItemTemplate for the treeview looks like this:
Saggio
  • 2,212
  • 6
  • 33
  • 50
1
2
3
36 37