compositecollection

How to handle a CompositeCollection with CollectionView features?

核能气质少年 提交于 2019-12-01 05:18:14
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. You can detect when the current item has changed by monitoring the ICollectionView.CurrentChanged event of your CollectionView. The following code works for me: CompositeCollection cc = new CompositeCollection(); cc.Add(new CollectionContainer { Collection = new string[] { "Oh No!", "Fie" } }); cc.Add(new CollectionContainer { Collection = new string[] { "Zounds", "Ods Bodikins" } }); CollectionViewSource cvs = new

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

限于喜欢 提交于 2019-11-30 21:37:26
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. <ComboBox SelectionChanged="ComboBoxOperatingPoints_SelectionChanged" x:Name="ComboBoxOperatingPoints" DropDownOpened="ComboBoxOperatingPoints_DropDownOpened_1" FontSize="30" HorizontalAlignment="Right" Margin="40,40,0,0" VerticalAlignment="Top" Width="200" Height="50" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding OperatingPoints}" DisplayMemberPath="name" SelectedValue="{Binding OperatingPointID

Why is CompositeCollection not Freezable?

心已入冬 提交于 2019-11-27 14:37:05
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 implement a ComboBox with an "extra" element beyond the collection my ViewModel provides that says "Select Item". <ComboBox> <ComboBox.ItemsSource> <CompositeCollection> <ComboBoxItem IsEnabled="False">Select Item</ComboBoxItem> <CollectionContainer Collection="{Binding MyItemsCollection}" /> </CompositeCollection> </ComboBox.ItemsSource> </ComboBox> The

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

时光怂恿深爱的人放手 提交于 2019-11-27 14:04:49
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<Cat> Cats { get; private set; } public ObservableCollection<Dog> Dogs { get; private set; } } <DataTemplate DataType={x:Type local:MyViewModel}"> <DataTemplate.Resources> <CompositeCollection x:Key="MyColl"> <!-- How can I reference the Cats and Dogs properties of MyViewModel? --> <CollectionContainer Collection="{Binding Dogs, ????}"> <CollectionContainer Collection="

Why is CompositeCollection not Freezable?

允我心安 提交于 2019-11-26 16:49:22
问题 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 implement a ComboBox with an "extra" element beyond the collection my ViewModel provides that says "Select Item". <ComboBox> <ComboBox.ItemsSource> <CompositeCollection> <ComboBoxItem IsEnabled="False">Select Item</ComboBoxItem> <CollectionContainer

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

南笙酒味 提交于 2019-11-26 16:35:32
问题 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<Cat> Cats { get; private set; } public ObservableCollection<Dog> Dogs { get; private set; } } <DataTemplate DataType={x:Type local:MyViewModel}"> <DataTemplate.Resources> <CompositeCollection x:Key="MyColl"> <!-- How can I reference the Cats and Dogs properties of