itemscontrol

WPF - Binding to an ItemsSource AND SelectedIndex throws exception?

This code give me an Argument out of Range exception. When I remove the binding to the SelectedIndex, the combobox is populated just fine and no exception is thrown. Any Idea what I am doing wrong? Is this (for some reason) not possible? public class RuleMap<T> : INotifyPropertyChanged { public ObservableCollection<string...

Using ItemsControl on a multi-leveled TreeView

My co-worker threatened to put me on TheDailyWTF today because of my property I wrote to be used to build a 3-tiered treeview with ItemsControl. I bear you the footprint: ObservableCollection<KeyValuePair<string, ObservableCollection<KeyValuePair<string, ObservableCollection<MyType>>>>>; My goal was to create an ItemsControl that wou...

Is it possible to get notification while adding items into itemsControl using Add() method in WPF

Actually I'm using an items control and animating the childrens of it. The problem is when adding the items dynamically through Add() method the first item is not getting animated and just comes to display as usual. I've planned to hide the dynamically added child and later make it visible when i want to use it with animation and that ...

Silverlight 3: Datagrid like grouping in ItemsControl

Is it possible to group items in a ItemsControl or Listbox in Silverlight? These controls are bound to a DomainDataSource. Or are there any 3rd party controls that do this? UPDATE: This is the sort of UI I am trying to create. ...

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 VerticalScrollbarVisibility is set to "Visible" instead of "Auto"). Any idea on how to solve this? Th...

Silverlight ItemsControl wih ColumnHeader

How can I add column headers to a Silerlight ItemsControl? I need a fast way to display a List of items that contains also some header info. ...

How to create an overlay for each item in an ItemsControl?

I'm trying to decorate an ItemsControl so that each item will have a Delete button that floats over the item's content under a specific condition inspired by somewhat by the iPhone UI. I have a few ways in mind of how I can approach this but I could use some guidance from other WPF folks who might have a better idea about how this would ...

How can I get a row wise tab order in an ItemsControl with a datatemplate?

I want the Tab go forward through each item in a row, and this for each row. But actually it goes through all items in a column, column after column! In the DataTemplate are 2 Comboboxes (let's say cb1 and cb1) and one TextBox (tb). The actual tab order is the following: Row0.cb1, Row1.cb1 ... Row0.cb2, Row1.cb2 ... Row0.tb, Row1.tb .....

WPF TabStop / TabIndex in ItemsControl

Hi guys! I'm dynamically adding WPF ComboBox-es and I want to be able to select the added ComboBoxes with the 'TAB' key. (Dynamically generate TabIndex or something) As it actually is: What I want: How would you do that? This is the code: <ItemsControl ItemsSource="{Binding}" Name="myItemsControl"> <ItemsControl.ItemTempla...

WPF: Simplest ItemControl will not display any items

I can't get the simplest idea of an ItemControl to work. I just want to populate my ItemsControl with a bunch of SomeItem. This is the code-behind: using System.Collections.ObjectModel; using System.Windows; namespace Hax { public partial class MainWindow : Window { public class SomeItem { public ...

Having trouble with custom panel coding -- can't figure out how to access properties of children

I'm working on a timeline that marks regions of audio signals when the user clicks the start and stop button. The user may click start and stop multiple times during a sampling session, and the time between presses should appear in the timeline as highlighted sections. The overall design is an ItemsControl whose ItemsPanelTemplate is a...

Replaced ItemsControl with ListBox and the item selection + ListBox height seems broken...

Hello, I have loaded this project into Visual Studio => http://sites.google.com/site/huyphamproject/Home/MyDashBoard.zip I have replaced all ItemsControl declaration in the main xaml file with ListBox so I have a SelectedItem property which I would need to use it with mvvm + datatemplate. When I select now one item in the ListBox-dash...

WPF: ItemsControl and DataContext

I have a main window with a single user control in it, called SuperMode. SuperMode consists of a collection of people and each person in this collection has their own collection of tasks. Sounds simple, right? From file SuperMode.xaml: <UserControl x:Class="Prototype.SuperMode" xmlns="http://schemas.microsoft.com/winfx/2006/xa...

How do I ensure only the headers are shown for the first item in an ItemsControl in WPF?

I am using MVVM binding an ObservableCollection of children to an ItemsControl. The ItemsControl contains a UserControl used to style the UI for the children. <ItemsControl ItemsSource="{Binding Documents}"> <ItemsControl.ItemTemplate> <DataTemplate> <View:DocumentView Margin="0, 10, 0, 0" /> </Da...

How can I retrieve the DataTemplate (and specific objects) of an item in an ItemsControl?

I have seen solutions to a very similar issue, yet it doesn't translate to mine. (Namely, this article: http://blogs.msdn.com/wpfsdk/archive/2007/04/16/how-do-i-programmatically-interact-with-template-generated-elements-part-ii.aspx) My ItemsControl is bound to an observable collection, which can have items dynamically added to it. ...

Selector that can only take child elements of a certain type?

I need to write a control that is supposed to take only a certain type of child controls. Functionally it works like a Selector in that I can select/activate on of its childs but it seems that I can not derive from Selector because an ItemsControl can take any type of child (object). I really would like to have compiletime typesafety her...

Massive memory leak when binding ItemsControl to an Observable Colleciton

I have an ItemsControl in a ScrollViewer. The ItemsControl.ItemSource is set to the Observable Collection. Every time I add an item to the collection, my application nearly doubles in memory usage and eventually after enough adds. Here is a rough sketch: <Scrollviewer Name="MyScroll"> <ItemsControl Name="MyItemsControl"> ...

ItemsPanel vs Grid vs GridSplitter

I am currently trying to build a ControlTemplate for an ItemsControl that uses the Grid as its ItemsPanel where each item is stacked horizontally and delimited with a GridSplitter. The basic goal is to have a dynamic bindable ItemsControl where all items stack up in a row and where each item can be resized with a splitter. There are ...

How to add children of an ItemsControl where the children should decide their own position in Wpf?

Hey all I am using a wpf slider to display the time line in a video player. I need to add an ItemControl of some sort on top of this so that I can add buttons on the time line on certain positions in the time line (the buttons will hold their own position relative to the parent ItemsControl). What ItemsControl container should I use wh...

When using ItemsControl ItemsControl.ItemsPanel is set to Canvas, ContenPresenter comes in and break my Canvas properties on the children [WPF]

I am using an ItemsControl where the ItemsPanel is set to Canvas (see this question for more background information). The ItemsControl is performing as I want, and it works like a charm when adding a child element manually by putting it into ItemsControl.Items: <ItemsControl> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> ...