Questions tagged [compositecollection]

50 questions
22
votes
1 answer

Why is CompositeCollection not Freezable?

I am writing an application using the MVVM pattern. I am providing data to my view by setting my view's DataContext property to an instance of my ViewModel. Generally I just use Binding from there and go about my way. Recently, I tried to…
Anderson Imes
  • 25,500
  • 4
  • 67
  • 82
20
votes
2 answers

CompositeCollection + CollectionContainer: Bind CollectionContainer.Collection to property of ViewModel that is used as DataTemplates DataType

I do not get the correct Binding syntax to access the Cats and Dogs properties of MyViewModel within a DateTemplate that defines a CompositeCollection within its resources. public class MyViewModel { public ObservableCollection Cats { get;…
Oliver
  • 1,507
  • 1
  • 12
  • 23
7
votes
3 answers

How to handle a CompositeCollection with CollectionView features?

Is there a way to get notified when CompositeCollection's current location changes? I need to have the CompositeCollection monitored by a CollectionView, any ideas are welcommed.
7
votes
1 answer

CompositeCollection/CollectionViewSource confusion

I'm a little confused about how the data binding works when using these types. I've read that you can't do the following public partial class Window1 : Window { public ObservableCollection Items { get; private set; } …
6
votes
1 answer

WPF CompositeCollection grouping by each collection view

I've set up a CompositeCollection containing two or more collections as follows (simplified):
Dan
  • 1,130
  • 2
  • 20
  • 38
5
votes
3 answers

Iterating through items of CompositeCollection

Consider the code: ObservableCollection cities = new ObservableCollection(); ObservableCollection states = new ObservableCollection(); ListBox…
Dudu
  • 61
  • 5
5
votes
1 answer

Source for CompositeCollection: why can't I bind against the data context of another control but have to use a CollectionViewSource?

In another question I recently asked, I was told to use a CompositeCollection in order to access various sources for a ListBox. The example used a XmlDataProvider to provide some dummy data. I, however, have a view model, which contains the data. It…
Em1
  • 1,077
  • 18
  • 38
5
votes
1 answer

How to add option "All" to a combobox in WPF with binding from Database

I have the following ComboBox in WPF. I know that I can add option ALL with CompositeCollection, but I don't know how. It would be great if somebody help me out with a short tutorial.
Lóri Nóda
  • 694
  • 1
  • 10
  • 20
4
votes
1 answer

ComboBox does not select proper item when bound to CompositeCollection

I have a ComboBox bound to a collection of animals. From it I select my favourite animal. I need a static null item above the bound items. I declare it using a CompositeCollection. When the ComboBox is bound it does not select my initial favourite…
idilov
  • 495
  • 6
  • 13
4
votes
1 answer

Work around for lack of Grouping in CompositeCollection

When I try to add a GroupDescriptor to my CompositeCollection I get an exception informing me that the CompositeCollection does not supporting grouping. I would like to know if anyone has found a good work around for this limitation. I have two…
vanja.
  • 2,532
  • 3
  • 23
  • 39
3
votes
3 answers

WPF Binding a MenuItem in a CompositeCollection not working

I'm having problems binding a command to a menuitem in a compositecollection. The MenuItem is part of ContextMenu which is defined in the UserControl.Resources. The problem is that the binding of the New label is not working. When I place the…
Bert Nienhuis
  • 31
  • 1
  • 2
2
votes
1 answer

How to merge two sources in a Collection and show them correct in a combobox?

I have some XAML code that makes me mad. It started all with adding a dummy Item for a not referenced value. For this I had to implement a CollectionViewSource and a CompositeCollection. Now I can't select the first Combobox Item, it appears but I…
kurdy
  • 441
  • 4
  • 15
2
votes
0 answers

How to set grouping on a wpf DataGrid that has CompositeCollection as item source?

I'm using c# and WPF. I have a WPF DataGrid that needs to be binded to several data sources. What I did is create for each data source the following code: var listCollectionView =…
2
votes
1 answer

Combobox with composite collection not updating with changes to observablecollection

As the title suggests; I have a combobox using a composite collection to bind to an observable collection using the MVVM pattern. If I load my model with existing data then the combobox shows the values so I know the binding works. I can add items…
chris
  • 132
  • 2
  • 11
2
votes
0 answers

ContentProperty does not work on List

What I want to archive is a class similar to CompositCollection for WinRT.
1
2 3 4