itemscontrol

Silverlight ItemsControl vertical scrollbar, using a wrappanel as ControlTemplate

I have a collection of elements, each one with a name and a subcollection of image blobs. I want to display an Accordion, with each item representing each of the MainElements. inside each element, I display the images in the subcollecion of said MainElement. The Accordion gets resized by the user, so I use a wrappanel for presenting the ...

Can you add CheckStates to a Button class as the ControlTemplate of a RadioButton?

I have a Radio button as the DataTemplate for an ItemsControl with the style name: MainMenuButtons. In my styles, I am trying to create a VisualState for Checked and Unchecked but I can't seem to get the button to change. My MainMenuButtons style class has a Grid as the ControlTemplate and the Grid contains a Button called RadioProxy. Ju...

ItemsControl.ItemsSource MVVM performance

I have an (non-virtualized) ItemsControl that binds its ItemsSource to a ObeservableCollection of ViewModel instances. Now once the large amount Model instances is loaded all the ViewModel complemnents needs to be added to that ObservableCollection. How can I add a large amount of ViewModels without making the UI Thread hang? I suppose ...

How to set Height of items in XAML so they always occupy the same proportion of available space in parent ItemsControl?

I have an ItemsControl with the following ItemTemplate: <DataTemplate x:Key="myItemTemplate"> <TextBlock Height="???" Text="{Binding Path=Description}" /> </DataTemplate> My question is, how do I set the Height of the TextBlock in the template so that it automatically assumes ItemsControl.Height div ItemsCount amount of vertical s...

Silverlight: Set Items Widths in ItemsControl to Stretch

I've got an ItemsControl which fills from top to bottom, but I can't get it's child items to occupy the whole width of the ItemsControl: I basically need to stretch the green bits to fill the width of the control (as shown by the blue bits). I've tried things like setting the HorizontalAlignment property of the template item to Stret...

WPF ItemsControl - how to know when the items finished loading, so that I can focus the first one?

Hi everyone, I have an ItemsControl in my View, that is bound to an ObservableCollection from ViewModel. The collection is filled, and afterwards an event from VM to view is raised (think search results and SearchFinished event). I would like to move keyboard focus to the first item in an ItemsControl, but when I do it in View's code-be...

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, 3". How can I add a separator to the individual items, without having one tacked on the en...

WPF: how to find an element in a datatemplate from an itemscontrol

Hi, I have the following problem: the application is using the custom itemscontrol called ToolBox. The elements of a toolbox are called toolboxitems and are custom contentcontrol. Now, the toolbox stores a number of images that are retrieved from a database and displayed. For that I use a datatemplate inside the toolbox control. However,...

ItemsControl ItemsTemplate vs ContentTemplate

Hi, Is there any difference between setting the ContentTemplate of a ListBoxItem, compared to setting the ItemsTemplate on the ListBox? Or is it just a preference? Just say you set the ItemsTemplate of the ListBox can you still get the Data Template you assigned to the ListBox ItemsTemplate via the ListBoxItems ContentTemplate? ie. Li...

How do I manually manage the generation of cell visuals with a GridViewColumn.CellTemplate?

I'm using WPF with .NET 3.0. I have a DataTemplate defined in XAML. I have a ListView with a GridView. I'd like to be able to generate the cell visuals with DataTemplate.LoadContent(), and insert the result into the GridView cell when needed. I need to do this so that I can set additional bindings on the generated visual object. Is ...

Good Silverlight Custom ItemsControl Tutorial

I'm afraid my Google-Foo is failing me again today. I'm trying to find a good tutorial on creating custom ItemsControls in Silverlight (though I imgaine a WPF version might work as well). I'm trying to create a custom ItemsControl that will be something of a virtualized ListBox. What I'm trying to accomplish isn't really similar enoug...

WPF: HierarchicalDataTemplate ItemsPanel

I have a TreeView which uses a custom ItemsPanel to show the first level of items in a StackPanel, but I need to show subitems in a StackPanel too. The problem is, the second level of items are shown in a WrapPanel, and as HierarchicalDataTemplate doesn't have an itemsPanel property I'm not sure how to do this. This is my xaml: <TreeVie...

How Do I Bind a "selected Item" in a Listbox to a ItemsControl in WPF?

LowDown: I am trying to create a Document Viewer in WPF. It will allow the user to preview selected documents and if they want, compare the documents in WPF. So they can view them side by side. The layout is this: Left side is a full list box. On the right side is a Collection or an Items control. Inside the items control will be a co...

Data-Virtualization problem with SurfaceScrollViewer

I'm in a situation where I'm using an ItemsControl with a SurfaceScrollViewer bound to an AsyncVirtualizingCollection and all of the data is being requested. I'm aware that it's due to the ItemsControl request all of the data but I'm not sure how to get around this. I've tried the AsyncVirtualizingCollection bound to a ListBox and it wo...

Data binding of itemscontrol in Silverlight 3.0

I am trying to define an itemscontrol and data bind it to a List and the code is as below. XAML <ItemsControl x:Name="ic" > <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock...

Memory leak with WPF & ItemsControl (VB.NET)

I have an ItemsControl that uses a DataTemplate to display properties in my customClass that implements INotifyPropertyChanged... Pretty straightforward... Some items in the DataTemplate use CommandBindings (such as buttons), and a few have some code-behind (yuck). When I empty the ItemsControl and set all instances of customClass =...

How to implement DisplayMemberPath for my Wpf UserControl?

I'm writing a WPF User Control for my application, wrapping a ListBox and a few other items. The ListBox has a new ItemTemplate that presents four pieces of information for each item in my list. I can hard code each of the four bindings to specific properties on my list items and they display fine. However, I want my UserControl to be ...

How do I use UI Automation on a WPF ItemsControl that groups items?

I am using Microsoft UI Automation (i.e. AutomationElement) to run automated acceptance tests against my application. This has gone well, but I've hit a situation that doesn't appear to be exposed to the automation framework. I have an ItemsControl (although I could be using one of its derived controls, e.g. ListBox) and I am using Coll...

ItemsControl and Focus Issue

I have an ItemsControl which is giving me issues. It has a DataTemplate, which contains a TextBox that is bound to a property in the code-behind. When I press the Enter key, a new element is inserted into the property. After this happens, the focus of the item in the datatemplate should shift down one item in the ItemsControl (done pr...

WPF - 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 am not aware of? To test I have been using the following block of code: <ItemsControl V...