collectionviewsource

Why does the WPF Databinding not update after the collection is Filtered?

Why does my WPF ContextMenu databinding not update as expected when the collection is updated, however the ItemTemplate is displaying the context menu text correctly? Within the code below this works when I don't try update the ObservableCollection. When the underlying ObservableCollection is updated the DataTemplate updates without pr...

sorting a bound ItemsControl in a DataTemplate (XAML only)

Is there a XAML only way to automatically sort the bound items (list of ViewModel object) ItemsControl based on one of the properties of the items. The ItemsControl is part of a DataTemplate. I thought CollectionViewSource would do the trick, but how do I bind the CollectionViewSource to the ItemsControl. The follwoing code dispays nothi...

DesignTime data not showing in Blend when bound against CollectionViewSource

I have a datatemplate for a viewmodel where an itemscontrol is bound against a CollectionViewSource (to enable sorting in xaml). <DataTemplate x:Key="equipmentDataTemplate"> <Viewbox> <Viewbox.Resources> <CollectionViewSource x:Key="viewSource" Source="{Binding Modules}"> <CollectionViewSource.Sor...

CollectionViewSource in silverlight

Hi, Based on the sample from http://msdn.microsoft.com/en-us/library/ms771725.aspx which is for WPF. I wanted same sample for silverlight as my requiremnts are same. but i get "AG_E_PARSER_BAD_PROPERTY_VALUE" poiting to in my XAML (FYI: xmlns:dat="clr-namespace:System.Windows.Data;assembly=System.Windows.Data"). Please help me in...

WPF Paged CollectionViewSource

I have a WPF ListBox that I would like to add pagination to as it starts getting slow with a bunch of items. My problem is that I use the Grouping, Sorting, and Filtering. That means if I were to limit the data with the LINQ Skip() and Take() methods or using something like a paginated ObservableCollection the grouping and sorting would ...

WPF Grouping using CollectionViewSource and DataBinding

I'm binding a CollectionViewSource to a ListView to group items. It all works great except when I update the ObservableCollection the CollectionViewSource is based on. If I update a value of an object in the collection the UI is never updated. Here is an example: <ListView x:Name="MyListView" Margin="0,0,0,65"> <ListView.Gro...

How to mimick the behaviour of an ObservableCollection for a List when it is a Source for a CollectionViewSource?

The code below works as follows: a form is shown with a list of sorted names. When the button is clicked a new name is added to the list at the appropriate sorted position from the textbox . When an item of the list is doubleclicked it is prefixed with "AAA", which triggers it to be placed on top of the list. When I change the Observable...

Trouble using CollectionViewSource in Silverlight

Hi, I having some trouble when implementing the CollectionViewSource in silverlight. I'm new in this topic, so basically I've been following what I find searching through the web. Here's what I've been trying to do so far. I'm creating a CollectionViewSource in the resources tag: <UserControl.Resources> <CollectionViewSource x:K...

Binding to CurrentItem in a ItemsControl

The XAML below is basically trying to make a list of Buttons (rendered from the 'Name' property of objects in the "Views" collection in the current data context. When I click on a button the CurrentItem property of CollectionView source should change and the associated View should be displayed in a content presenter. OK. If I click in...

MVVM CollectionViews in WPF Application Framework (WAF)

In short my question is: How do you prefer to expose filtered/sorted/grouped ObservableCollections to Views in WAF? I was fairly happy with my first attempt which involved filtering on the VM and exposing an ICollectionView of Model objects for the View to bind to: public StartDetailViewModel(IStartDetailView view, StartPoint start, Sc...

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. ...

Bind a Wpf HierarchicalDataTemplate ItemsSource to a CollectionViewSource in a dictionary?

I'm trying to display a Wpf Treeview with items sorted by a CollectionViewSource. Currently, everything is working except sorting using this code in my resource dictionary: <HierarchicalDataTemplate DataType="{x:Type books:Container}" ItemsSource="{Binding Path=Items}"> <nav:ContainerControl /> </HierarchicalDataTemplate> What wo...

CollectionViewSource Use Question

I am trying to do a basic use of CollectionViewSource and I must be missing something because it is just not working. Here is my XAML: <Window.Resources> <CollectionViewSource Source="{Binding loc:MainVM.Instance.MapItems}" x:Key="MapCV"> <CollectionViewSource.GroupDescriptions> <PropertyGroupDescription PropertyName="So...

Any idea on how to sort a CompositeCollection?

I have a CompositeCollection that consists of ObservableCollections of two types: Companies and Contacts. Contact has a property FullName while Company has a property Name. I want to apply sorting so the collections are mixed by their types but sorted by their name, example: Itzhak Perlman John Doe Microsoft Sarah Moore StackOverflow W...

WPF CollectionViewSource Multiple Views ?

Hi ! I've written a Custom WPF Control with search extension, let's name it MyControl. The Control is a descendent of an ItemsControl class. So I feed the the data source to it like this: The control itself uses protected override void OnItemsSourceChanged(System.Collections.IEnumerable oldValue, System.Collections.IEnumerable new...

Finding all the ICollectionView's attached to a collection

We have multiple filters based on the same collection. i.e. we are displaying the same collection in a variety of ways. What i would like to be able to do is ask all of the CollectionViews to refresh when a property changes (as the collection view will only refilter if items get added/removed from the collection). Is there a way to find ...

Can you turn off selection syncing in WPF's CollectionViewSource?

Hi everyone, I have several CollectionViewSource instances all used on the same ObservableCollection. I also have several controls that need to show filtered versions of the collection (hence the CollectionViewSources). The problem I'm having is that CollectionViewSource forces them to all have the same item selected. Is there some way ...

ICollectionView.SortDescriptions does not work for boolean

Hi ! myListBox.Items.SortDescriptions.Add( new SortDescription("BoolProperty", ListSortDirection.Descending)); This sorting works only for string properties of the underlying project. Not with boolean? Is there a reason for that ? Thanks ! UPDATE: Yep, your example really works. But what's wrong on my example ? public clas...

CollectionViewSource and Linq

Hello What is the easiest way to find an item in CollectionViewSource? I can't seem to find a linq friendly property. I would like to do something like MyCollectionViewSource.View.Where(x=>x...) Cheers, Berryl ...

CollectionViewSource CurrentItem

Hello I am using a CollectionViewSource in a dialog view model that has various filtering requirements, which works fine. I also maintain the equivalent of the selected item in a property (SelectedProject), and I'm wondering if I could / should do away with it since the View will know the current item. My data binding looks like: <L...